# For Helix Subscriber Count

**URL:** <https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775>\
**Category:** API\
**Created:** [October 3, 2021, 3:39pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775 "2021-10-03T15:39:07Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 4, 2021, 10:10pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/21 "2021-10-04T22:10:00Z")

</div>

> [@kurinshikari](#):
>
> Can you help me create a permanent token?

There is no such thing

Under the normal authentication flow you get a user token and a refresh token

You can use the refresh token to get a new access token when the access token expires. (Then store the new access and refresh tokens)

A refresh token doesn’t have an expiration but maybe become invalid for another reason requiring you to get a new access and refresh token key set again manually

---

<div class="post-metadata">

**Author:** ![kurinshikari](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/kurinshikari/32/13768_2.png) [@kurinshikari](https://discuss.dev.twitch.com/u/kurinshikari)\
**Post date:** [October 12, 2021, 8:43pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/22 "2021-10-12T20:43:29Z")

</div>

I still haven’t been able to solve the problem. The only problem is I can’t create a token.If I can create a token, everything will go smoothly.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 12, 2021, 8:44pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/23 "2021-10-12T20:44:58Z")

</div>

> [@kurinshikari](#):
>
> The only problem is I can’t create a token.

Whatr problem are you facing?

> [@BarryCarlyon](#):
>
> This is the oAuth flow in a nutshell:
> 
> - Create a webpage with a link as in `<a href="">Login With Twitch</a>`
> - This will be a link to Twitch along the lines of:
> 
> `https://id.twitch.tv/oauth2/authorize?client_id=CLIENTID&redirect_uri=URLENCODEDRETURLINK&response_type=code&scope=channel:read:subscriptions`
> 
> - The user you want to read subscribers of will click this link
> - The user is then asked if they wish to allow `CLIENTID` access to their account.
> - The user click yes/no
> - If yes, the user is then rediredrect back to `RETURNLINK` with a `?code` in the URL
> - The webpage at `RETURNLINK` then will do a POST req

Covers the steps needed to create user tokens

---

<div class="post-metadata">

**Author:** ![kurinshikari](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/kurinshikari/32/13768_2.png) [@kurinshikari](https://discuss.dev.twitch.com/u/kurinshikari)\
**Post date:** [October 12, 2021, 8:48pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/24 "2021-10-12T20:48:27Z")

</div>

> [@BarryCarlyon](#):
>
> This is the oAuth flow in a nutshell:
> 
> - Create a webpage with a link as in `<a href="">Login With Twitch</a>`
> - This will be a link to Twitch along the lines of:
> 
> `https://id.twitch.tv/oauth2/authorize?client_id=CLIENTID&redirect_uri=URLENCODEDRETURLINK&response_type=code&scope=channel:read:subscriptions`
> 
> - The user you want to read subscribers of will click this link
> - The user is then asked if they wish to allow `CLIENTID` access to their account.
> - The user click yes/no
> - If yes, the user is then rediredrect back to `RETURNLINK` with a `?code` in the URL
> - The webpage at `RETURNLINK` then will do a POST req

Is it possible to create a token where my channel can read all the stats?

I just want to show the information of a channel that belongs to me on my own website.Does anyone have to login to view this?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 12, 2021, 8:50pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/25 "2021-10-12T20:50:17Z")

</div>

> [@kurinshikari](#):
>
> Is it possible to create a token where my channel can read all the stats?

What do you mean “all stats”

> [@kurinshikari](#):
>
> I just want to show the information of a channel that belongs to me on my own website.Does anyone have to login to view this?

You need to create a token for _your_ account that can read this data.

Then you have a script that will use that token and store information in a DB/other storage.  
And your website reads from the DB.

---

<div class="post-metadata">

**Author:** ![kurinshikari](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/kurinshikari/32/13768_2.png) [@kurinshikari](https://discuss.dev.twitch.com/u/kurinshikari)\
**Post date:** [October 12, 2021, 9:01pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/26 "2021-10-12T21:01:44Z")

</div>

> [@BarryCarlyon](#):
>
> What do you mean “all stats”

Subscriber count, Follower Count, Online / Offline Status, Last Follower Name, Last Sub Name etc.

> [@BarryCarlyon](#):
>
> You need to create a token for _your_ account that can read this data.

That’s exactly the problem! I can’t create token.How do I get the token code?

 ![image](https://d2opxh93rbxzdn.cloudfront.net/original/2X/c/ce8dcd6c06b4571a4c8e783e31b88753fee0b87e.png)  
Where is my token code ?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 12, 2021, 9:02pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/27 "2021-10-12T21:02:52Z")

</div>

You will need to modify the code example you have used to generate this output and adjust it to do what you need to do.

> [@kurinshikari](#):
>
> Subscriber count, Follower Count, Online / Offline Status, Last Follower Name, Last Sub Name etc.

Subscriber is the only data that needs a scope. everything else is public and any token works

---

<div class="post-metadata">

**Author:** ![kurinshikari](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/kurinshikari/32/13768_2.png) [@kurinshikari](https://discuss.dev.twitch.com/u/kurinshikari)\
**Post date:** [October 12, 2021, 9:08pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/28 "2021-10-12T21:08:52Z")

</div>

Can you check the picture I sent?  
Will I create the token via this script? Go auth clicked.After i accepted all, But i dont see any token code.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 12, 2021, 11:06pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/29 "2021-10-12T23:06:21Z")

</div>

> [@kurinshikari](#):
>
> But i dont see any token code

Becuase you need to modify the code to do what you need it to do

The PHP Example

> [@BarryCarlyon](#):
>
> This is a “one page” example in PHP that will do “regular/refreshable” User authentication that should serve as an example to build you own flow for this [twitch\_misc/authentication/user\_access\_generator/php at main · BarryCarlyon/twitch\_misc · GitHub](https://github.com/BarryCarlyon/twitch_misc/tree/main/authentication/user_access_generator/php)

Stores the generated token in `$_SESSION` you need to modify the script to do what you need it to do.

It’s an exmaple script to demonstrate how you can authenticate and obtain a token in PHP.

So you could change this script to generate a token and store it in a DB for your Cron Scripts to collect your sub/follow count/etc for display on your website

So take the script and adjust it accordingly to meet your needs.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [November 11, 2021, 11:07pm UTC](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775/30 "2021-11-11T23:07:08Z")

</div>

Closed on November 11, 2021, 11:07pm UTC

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

[Previous page](https://discuss.dev.twitch.com/t/for-helix-subscriber-count/33775.md?page=1)
