# Know if user is follower or sub

**URL:** <https://staging-discuss.dev.twitch.com/t/know-if-user-is-follower-or-sub/13357>\
**Category:** Extensions\
**Created:** [December 19, 2017, 7:31am UTC](https://staging-discuss.dev.twitch.com/t/know-if-user-is-follower-or-sub/13357 "2017-12-19T07:31:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Warner](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@Warner](https://staging-discuss.dev.twitch.com/u/Warner)\
**Post date:** [December 19, 2017, 7:31am UTC](https://staging-discuss.dev.twitch.com/t/know-if-user-is-follower-or-sub/13357/1 "2017-12-19T07:31:26Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [December 19, 2017, 10:50am UTC](https://staging-discuss.dev.twitch.com/t/know-if-user-is-follower-or-sub/13357/2 "2017-12-19T10:50:34Z")

</div>

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](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://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!

---

<div class="post-metadata">

**Author:** ![Warner](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@Warner](https://staging-discuss.dev.twitch.com/u/Warner)\
**Post date:** [December 19, 2017, 3:22pm UTC](https://staging-discuss.dev.twitch.com/t/know-if-user-is-follower-or-sub/13357/3 "2017-12-19T15:22:10Z")

</div>

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 😕

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?
