OAUTH Connector for Twitch.tv

OAuth DONE, Start developing today

DEMO FEATURES HOW-TO BUY

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

FEATURES

HOW-TO

Implementation

First, setup your Twitch Developer Account and application. Then get your Client-ID and Client-Secret. Afterwards, insert the Client-ID and Secret into the config.ini - a more detailed Instruction is included after your purchase.

How to setup the Class and use the sample function (the same, as this website!)

try { // Instantiate a new TwitchApi object. Make sure to provide the correct path to the 'config.ini' file. $twitchApi = new TwitchApi(__DIR__ . '/path/config.ini'); $streamers = ['LIRIK', 'RIOTGAMES', 'RocketLeague', 'NYC_Timescape', 'nocopyrightsounds']; $randomStreamer = $streamers[array_rand($streamers)]; // Call the getID() function and pass the name of the Twitch user whose ID you want to retrieve. $id = $twitchApi->getID($randomStreamer); echo $randomStreamer . " - ID: " . $id; } catch (Exception $e) { // If something goes wrong, the script will catch the exception and print its message. echo "We encountered an issue. Please refresh or try it again later."; }


Requirements



This script is based on the new Twitch API (2020). The previous Twitch API was v5 / KRAKEN (deprecated).

BUY THE SCRIPT