OAuth Connector for Twitch.tv - PHPOAuth Connector for Twitch.tv - PHP
You want to start using the Twitch API, but are finding OAuth authentication challenging? Then this product is perfect for you!OAuth Connector for Twitch.tv - PHP
You want to start using the Twitch API, but are finding OAuth authentication challenging? Then th...Overview
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 both 'app access token' and 'user access token', which means this function can be implemented using our OAuth Connector: https://dev.twitch.tv/docs/api/reference/#get-videos
The "PHP OAuth Connector for Twitch.tv API" isn't endorsed by Twitch or Amazon and doesn't reflect the views or opinions of Twitch or anyone officially involved in producing or managing Twitch or Amazon.
Features
- easy to use and provides you a head-start for your development
- sample function included
- automatically gets the OAUTH token after first script runtime
- automatically refreshes the twitch OAUTH token (expires every 60 days)
Requirements
- PHP knowledge
- PHP Version: at least version 8.0 - higher is recommended
- Server needs to have permissions to read and write to the config-File
- cURL needs to be enabled in the php.ini / allowed on the server
Instructions
You will also get all Instructions in the README file after your purchase!
In general you have to do these steps:
1: Register your app at Twitch Developer to obtain a client ID and client secret
2: Paste your Client ID and Client Secret into the config.ini file into the according keys
3: Download the package, extract it and copy the files into the folder of your website / webapp
4: Use the following code to try out the OAuth Connector and the sample function to get a working response from the Twitch API
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'); // Call the getID() function and pass the name of the Twitch user whose ID you want to retrieve. $id = $twitchApi->getID('LIRIK'); // echo the Streamer and his Twitch ID echo "LIRIK - 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."; }
5: Use the included sample function (getID) as your starting point to easily develop your own functions and quickly develop your needed functionalities!
Other items by this author
Category | Scripts & Code / PHP Scripts / Social Networking |
First release | 27 June 2023 |
Last update | 27 June 2023 |
Software version | PHP 8.0, PHP 8.1, PHP 8.2, PHP 8.3 |
Tags | app, application, php, easy, site, Web, API, live, stream, quick, development, oauth, twitch, twitchtv |