How to return more than 25 subs

I am using

To return the subscribers to my channel.
But what if my channel has 2000 subscribers?
This method only returns the most recent 25 subs.

I want all of the list, how can I do that?

Please read the documentation that you linked to

Optional Query String Parameters

Name Type Description
limit integer Maximum number of objects to return. Default: 25. Maximum: 100.
offset integer Object offset for pagination of results. Default: 0.

Oh but the maximum is 100.
The channel I want to check has around 1500 subs.

So what?

With a limit of 100

  • Page 1 is offset 0
  • Page 2 is offset 100
  • Page 3 is offset 200

And so on

1 Like

Ok, so probably the best thing to do if I want to see that a person is my sub is using this

where

GET https://api.twitch.tv/kraken/channels/<channel ID>/subscriptions/<user ID>

Channel ID is the ID of my channel and user ID is the other one, right?
But to do so I have to generate an Oauth with scope channel_check_subscription.
Is it good if I go to Twitch OAuth Token Generator and generate it?
Because I don’t know if this token disappear after some time or not.
I need it to be permanent.

This is something you don’t control. It could change or break at any time and your oAuth could die. I wouldn’t use it

Correct

Also correct

Ok but then what’s the solution if I need a permanent oauth token that enables me to check if someone is my sub?

Create your own oAuth maker

Ok but this needs a server, right?
Because I am the same person that did a question yesterday and if you remember it was the website developed in Angular.

So I want to do everything client side.

If you need to do this just to generate a token for yourself, it needs to only be reached from localhost.

So you don’t need a web accessible server. You just need a you accessible server.

Ok but then I don’t see the difference in making the token with the website that I have linked before and a personal server, can you explain?

If you make the token on someone elses site.

And their ClientID gets disabled, your token stops working
If they reset the Client Secret, your token stops working.
If they suddenly drop off the face of the earth, your token stops working.

Additionally, they may use a Legacy Client ID, which means tokens it makes last forever. Soon™ Twitch will expire all Legacy Client ID tokens.

Which means, your token stops working.

And because you don’t have the client secret, or the refresh token you cannot make a new token. Which means, your token stops working, and you will HAVE to make a local server to generate an access and refresh token one time.

Additionally, whenever you change your password using forgotten password on Twitch, all your tokens for all services stop working, so you’ll either have to reuse the site or jump thru your local website. Thats assuming that their site is still around and working.

That’s clear, thanks. Can’t I use implicit token to get my oauth?

GET https://id.twitch.tv/oauth2/authorize
    ?client_id=<your client ID>
    &redirect_uri=<your registered redirect URI>
    &response_type=<type>
    &scope=<space-separated list of scopes>

Using as scope the one I need, in my case it is channel_check_subscription

You can use a implicit auth to get a token with channel_check_subscription

but

  • the token is only valid for 15 minutes or so
  • the token does not come with a refresh token so you cannot renew it

So every 15 minutes you need to reauth yourself.

Ok, instead with OAuth Authorization Code Flow I can get a permanent token.
That’s clear now, thanks.

One last question: I cannot see how to use state.
In the example it is set to

c3ab8aa609ea11e793ae92361f002671

But how to get this value?

State is irrelevant

From the docs

Your unique token, generated by your application. This is an OAuth 2.0 opaque value, used to avoid CSRF attacks. This value is echoed back in the response. We strongly recommend you use this.

State is whatever you want it to be, for you to generate a token for yourself to use, it’s totally irrelevant

That’s clear.
Can I use Postman to do the GET request for the token and then the POST for the final token that, if I have understood, will look like this:

{
  "access_token": "0123456789abcdefghijABCDEFGHIJ",
  "refresh_token": "eyJfaWQmNzMtNGCJ9%6VFV5LNrZFUj8oU231/3Aj",
  "expires_in": 3600,
  "scope": ["viewing_activity_read"],
  "token_type": "bearer"
}

?

No

Because step 2 of oAuth is a redirect to your redirectURL.

I don’t use postman so it might be configurable to add a redirect. But I’d just knock up a localserver to handle the authing

Oh, right, so the redirect need to point to my listening server. that’s fine.

What about the

"expires_in": 3600,

mentioned inside the token?
Is it possible to get an unlimited value for it?

No

When the expires_in is done or near done use the refresh_token and secret to get a new access token