First of all: I’m not a dev, just trying to apply stuff for my website, learning here and there what I can !
I’m using Helix API using cURL with PHP, along with my Client ID (am I saying this right?) to get a list of some Twitch channel I want to be displayed on my website, depending on if they are online or not.
Problem is that if I refresh too often, or change pages too quickly, I’ve for Failed error 429 message. I think I’m understanding that it’s due to a limitation about the number of request I’m doing (https://dev.twitch.tv/docs/api/guide ?) per IP? Is that correct?
Is there a way to work around that? Cause I’ve got more and more streamers to add there and I don’t want people to have this error message appearing everytime they switch page ? (cause ye, this list appears on each page)
Once you’ve got that Access Token you can make requests by using the Authorization: Bearer <Token> header.
Those requests MUST be done server-side as you must not expose your client secret to the client. If you wish to do API requests client side you should use the Implicit Auth Flow https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-implicit-code-flow where the user is redirected back to your website with a User Access Token in the url hash, which the frontend can use as the Authorization header in the same way I previously mentioned.
The OAuth process is the part where I do the cURL?
Yes I read the instructions but to be honest it’s really not clear at all to me…
I understand for the server-side, but first I would need to have a proper code that actually does what I need, and I can’t seem to find how to turn theory intro code…
End of the story:
-I’ve created a .php file containing a script that get the token, and fill in my DB
-A cron in the server gets this done every minute
-on my webpage, I only get some small code that reads the database, and displays it
My page loads soo much faster now, and that works great.
Thank you a lot for your help, I wish I could do something in return ! ahah