Know if user is follower or sub

Hey, im creating a panel extension and im a bit confused about how can i know if the viewer using that extension panel is actually a follower or sub to the channel he is vieweing… i tried adding the scope “channel_check_subscription” on the extension settings, so now when i install the extension as the broadcaster i go throu the oauth flow to authorize the extension with the check subscriptions scope, i accept, the panel extension gets activated but now im still confused as how do i check if the viewer is an actual sub, i tried hitting the kraken at https://api.twitch.tv/kraken/users//subscriptions/ but that needs an oauth token and as far as i saw the oauth token from when i activated the extension has a shor lifetime so thats not the one right?

Thanks in advance

Using channel_check_subscription, the broadcaster should of when attempting to activate the extension been sent thru an oAuth loop and performed the oAuth loop. You then stored the access_token and refresh_token

When the access_token expires (which you can check using the expires_at passed when you oAuth loop), you can use the refresh_token

When a user/viewer allows you to access their UserID, you then need to pass that to your EBS which can perform the lookup as signed with your secret.

But you are calling the wrong end point. For the scope you have requested you need this https://dev.twitch.tv/docs/v5/reference/users#check-user-subscription-by-channel end point not the general subscriptions end point. https://api.twitch.tv/kraken/users/<user ID>/subscriptions/<channel ID>

And of course follows is on https://dev.twitch.tv/docs/v5/reference/users#check-user-follows-by-channel https://api.twitch.tv/kraken/users/<user ID>/follows/channels/<channel ID>

Hope this helps!

That end point its the same i mentioned, or at least the same i used, maybe i just typed it wrong

So does that mean i have to be refreshing the token ever 200 minutes (thats the aprox expire time i noticed for the token that is being generated in the oauth loop when the broadcaster installs the extension??

This doesnt seem like a good solution i would have to have a server service just refreshing the token, seems like a waste of resource :confused:

As a side note, for a test, i did stored the oauth token and tried to use id with that endpoint and it said it was an invalid token…

Still, like i said refreshing the token everysingle time seems a lot of resource waste, is there really no other way?