Is there a step by step guide showing live streams in Category in our game

Authentication is covered here, and there are a few forms of auth depending on what you need to do.

The Token in that example, in the docs is an example token, so not a valid one to use. It’s display in the docs so people know how to correctly format the call.

You need to replace the ClientID with your ClientID and generate a valid token.

In order to generate a token in your game, in order to call the API, you will need to ask the user to login with Twitch, otherwise you won’t have a token to use.

Alternatively your game can phone home to your server and your server can use an App Access Token to fetch the channels live with your game.

DO NOT GENERATE AN APP ACCESS/CLIENT CREDENTIALS TOKEN IN THE GAME ITSELF as this would mean you are leaking your Client Secret in your game.

So you have two options:

The second option is more practical as you’d use a CronJob to generate the list of live streams, and doesn’t require the player to login to Twitch (if the player even has a Twitch account) and just write a JSON file that your game can fetch as needed and the CronJob updates that list. This also means your stream dispaly doens’t need to wait for token generation and/or the API to return data, as you already generated a cache file for the game to use to build out the list of streamers live.

For Example:

That is what the “Extension in Action” list on my Extension information page over at IGDB.com Game Information | Twitch Extensions uses.

A CronJob using an app access token to generate a JSON file located at https://twitch.extensions.barrycarlyon.co.uk/igdb/streams.json, in this example calling the “Live Activated Channels with my extension” rather than a “what channels are live with my game” but the principal is the same, periodically build a JSON file for the frontend to use, and then the frontend has no visible token anywhere, meaning no Twitch Login by the user or a leaked client secret.