Skip to content

Twitch Link and Login

This tutorial covers how to set up a Developer Account with Twitch and where to find the ClientID and Secret, as well as how to get/use the RedirectURL.

Twitch Developer Account Setup

In order to use Twitch for authentication into ChilliConnect you will need the following details to allow ChilliConnect -> Twitch Communication: ClientID, ClientSecret and a RedirectURL. You will need to first sign-up for a Twitch Account, then navigate to the Developers Dashboard.

Once in the dashboard go to the Apps section by clicking on the VIEW APPS button.

If you have registered a Twitch Application before it will appear on this screen, but in order to create a new Application select the "Register Your Application" button on the top right of the table. You should be presented with a short setup wizard that will need a few details before continuing.

The main detail here is the OAuth RedirectURL, but leave it blank or placeholder for now as we can come back to that shortly; it can be edited at anytime. Once you have finished putting in these details you will be redirected back to the main Apps dashboard screen, with your new Application listed. Click the manage button in order to be taken into an "Edit" screen where more options are now available.

The three details you will ultimately need are on this page; the ClientID and ClientSecret are simple to understand, they are used during the server exchange to identify ChilliConnect to Twitch as authorised to use the API for your Application. The RedirectURL is slightly more involved in the development process of your Application; This is the base URL that Twitch will use to supply your Application with the Authorisation Code that ChilliConnect needs to actually get back the users details.

In a nutshell, when your application comes to ask the Player to sign in with Twitch, the Player will be presented with a Twitch login screen. After the user has successfully logged in, the Twitch service will then Redirect the user LOCALLY to the RedirectURL specified on this configuration screen. So if you have entered http://localhost as the redirect URL, after the user has successfully entered login details the device will then attempt to open the URL http://localhost/?code=authCode&scope=&state= (with authCode being the string that we will need).

There are a few ways to handle this process on Mobile Devices, one of the main ones being App-Claimed URLS. The full process is covered properly on the OAuth Website but the general gist is that the Application will override a URL pattern to launch the Application when that URL pattern is detected, so by overriding the URL pattern newapp://callback and inputting the same URL into the RedirectURL Configuration on Twitch, the app will be launched to handle the callback from Twitch, and grab the Authorisation Code from the URL.

The ClientID, the ClientSecret and this RedirectURL all need to be copied into ChilliConnect. Under the "Game" section, navigate to the "Settings" tab and scroll down until a section titled "Twitch OAuth" is seen. Edit these details so that they mirror the details given to the Twitch Configuration.

This should be the last piece of configuration you need to allow Twitch logins with ChilliConnect. Upon receiving the Authorisation Code from Twitch using the RedirectURL, it can then be sent up to either Link with Twitch or Login with Twitch if an account id already linked. The best way to use this functionality is to create your players with the Login with Twitch method whilst supplying the CreatePlayer flag. This is the shortest way to creating a new Player with a Twitch Login.

One Important Note: AuthCodes can only be used once. Meaning that the same AuthCode that was used to link a Player with a Twitch account cannot be used again.