Need help with Twitch Connect

So I’m trying to implement twitch connect onto my website in order to restrict certain things to be used by certain people.
I’m trying to make it so once they click a twitch button it checks if they are a subscriber and if they are it allows them to proceed. I’m also trying to make it so subscribers can click a button and it generates a code. I don’t want this to work for anyone but subscribers.

I’m trying to make something like this. http://info.cdnthe3rd.com/nfsylvania.php

If anyone can help it would be greatly appreciated. Thanks.

Look at the authorization guide on the twitch api and then use your app id with your oauth to collect your current subs with your channel get request. You can store them or just dynamically scrape them on each request, your choice.

That’s where I would start.

Good luck

Not sure if you would know this but I found the guide and I believe I need to follow the authorization code flow. When filling out step one. What is the &state [your provided unique token]?

We support the state OAuth2 parameter, which is strongly recommended for avoid cross-site scripting attacks. If included, it is appended to the list of query parameters when redirecting the user to the redirect_uri.

The parameter force_verify can also be appended to this URL. This parameter decides whether the user should be re-prompted for authorization. The default is false, so a given user will only see the authorization page for a given set of scopes the first time through the sequence. If set to true, the user will always be prompted to confirm authorization. This is useful for allowing your users to switch Twitch accounts, since there is not a way to log users out of the API.

So the above suggests that the state is a oauth token, however, you haven’t yet been provided with a authed user token. So - Who’s oauth token DO you have access to? :wink:

The state is NOT an oAuth token

State is used to pass information into the Auth flow that is then passed back to you when the user comes back from logging in to Twitch and providing access to your Application.

Since you don’t know what it is for, you probably don’t need to use it.

@Optimal you are looking at using https://github.com/justintv/Twitch-API/blob/master/v3_resources/subscriptions.md#get-channelschannelsubscriptions for what you are after.

(But if you have cdnthe3rd’s oAuth access to his subs list there is an alternative method but the above should suffice as you only need to oAuth the user)

I’ve done stuff for you guys before so if needs be you can drop me a line and I’ll see if I can squeeze you in if you get completely stuck

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.