Use Twitch as 'lock' to personal website, possible?

I do believe it is, as I’ve googled and found old code, but things have changed, back end APIs and front end stuff. (and I’m a google php coder, i.e. I bolt together code I find around the internet, until it works)

I know how to generate a client_id and I understand the basics of it, as I’m able to generate a url to return the results I need. But I’m stuck as to snapping it into my PHP.

Currently, while I’m streaming, I have a website that I’m hosting on a VPS that connects to my music player, that is being streamed to a different location for my viewers to log into, listen to the music and put in song request (this stops it going over the internet and causing VOD mutes).

Currently at the moment, I have a password that changes regularly, that I provide to my subscribers (as it’s sub only). But I thought to myself, there must be a way, using twitch, to allow a person to the page, if they are a subscriber after they have ‘authd’ with the twitch page?

I’ve messed around with various calls from the API, I’m able to get a 401 if I’m not logged in, and details about myself when I am logged in, but rather than re-invent the wheel, I was wondering if anybody else already has some php code, that I can just change my details into, and use it as a lock screen, so only my subscribers can get to the destination page?

Thanks in advance for any tip and/or techniques (or code).
Regards
Paul.

Have a look at our authentication examples and check user subscription by channel.

So, am I supposed to copy my current index.php and include it into this index.php, is the index.php pulling the twitch.php to do the auth? and then would continue the code ‘if’ it’s authorized?

I get this code seems to be revolving around league of legends, mentioning installing other code, etc.

I edited the index.php, adding the details that were needed, and ran it, nothing happened, no auth request, just a blank page?

Is this PHP code compatible with PHP7x ?

They’re meant to be examples, not necessarily plug-and-play implementations. OAuth 2.0 and OIDC, which have simplified documentation as part of our authentication docs, are standard in the industry. You should have no trouble finding a library that does the one you need for PHP7. Implementing the flow you need yourself is not a huge task either, but you need to understand how it works.

Well this is going way over my head, looks like I’m gonna turn to fiverr or similar so see if I can get someone to code something for me.

Thanks for your input.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.