Hey, I’ve been on the forum searching for my answer for long now, but I need help to connect my website to the New Twitch Api, but I don’t know how to do. Can someone explain me it easily ?
I’m a new developer and the docs seems very complicated for me… Plus, I’m not English so I don’t understand some things in the docs.
I’m using ReactJS and Axios to retrieve data, and I need API to check if I’m streaming or not, and get the Stream’s title, game, watchers, etc…
So the OAuth token is used, to make sure you have the right access to access this endpoint. In general this shows how the Authentication of the Twitch API works. This shows how to do this for an OAuth token: https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/ Authentication is a rather big topic to summarize, so i think it would be easier that you take a look at the guides first and just hit me up with any specific questions that might come up.
here you should be getting your React Server to generate an App Access Token (aka Client Credentials)
Then your front end will call your backend, and the backend performs the API call
Your backend may also then utilise Webhooks for Stream Updates if thats useful and/or caching to negate the need to call the Twitch API at all.
(Why go fetch data if you already fetched it in the last 5/10 minutes (or cache as relevant depending on the endpoint))
if you want to be pure front end, then every user visiting your website, will need to login with Twitch in order to get a token so you can call the API.