I’m working on a website for a Twitch streamer that has a sub button.
On his website I have a “Connect with Twitch” button that uses the
All that works fine.
Now my question is: How can I send subscribed accounts to one page, and non-subscribed accounts to a different one? Also, how do I make this page only reachable if
user_subscriptions = true?
I would appreciate any help.
Use the /users/:user/subscriptions/:channel endpoint with the channel name and the access token. You can see example data and status codes on the page I linked. Use the status codes to check if a user is subscribed/not subscribed.
@Decicus Thank you very much.
I need help on how to do this. How and where do I exec status codes? And how can I link this to give access to a page, and if return=false then no access.
The API returns a JSON object. You will most likely have to convert the JSON object into an object the language understands (such as PHP’s json_decode()) before you can access those values. If the “status” value of the object is set, don’t give access and maybe display the “error” value. You can use any of the other values to verify if the user is subscribed (such as “_id” or “created_at”).
@Decicus Thanks. I’ll try and figure out how to do this, I’m completely new to API, php and JS. Doing this from a blank page.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.