What is this?
If you're a developer looking to utilize the Twitch API, but are finding OAuth authentication challenging, this PHP OAuth Connector is the perfect solution for you!
Our OAuth Connector takes care of the authentication process, freeing you to focus on coding. We've also included a sample function to demonstrate its use, which can be easily modified to suit your specific needs, accelerating your development process.
The Connector retrieves and refreshes OAuth tokens using your provided client ID and client secret. We've included a guide on how to obtain these from Twitch.
Please note, this OAuth Connector is designed for obtaining 'app access tokens' only. Before proceeding, ensure your planned functionalities only require an 'app access token'. To verify this, check the 'Authorization' section of the function you're implementing on the Twitch API reference page:
https://dev.twitch.tv/docs/api/reference/
For instance, the 'Get Videos' function accepts one of two possible choices: the 'app access token' OR the 'user access token', which means this function can be implemented using our OAuth Connector:
https://dev.twitch.tv/docs/api/reference/#get-videos
DEMO
The Script in Action!
To show the working script, I'll demonstrate it using the included sample function "getID()", where you can get the TWITCH ID for a specified Twitch Username. These are randomly chosen streamers from an array. Refresh the page to see different IDs!
Disclaimer: As long as you see the according ID for the Username, you know that the script is working!
Look at the "HOW-TO" step to see the code I used for this randomizer.
RIOTGAMES - Twitch ID: 36029255