Check Scopes for Existing Token

Is there a way to get the scopes for a specific token I have?

Make a request to: https://api.twitch.tv/kraken

With your Key in the headers, It’ll return something like (for v3)

Array
(
    [identified] => 1
    [token] => Array
        (
            [valid] => 1
            [authorization] => Array
                (
                    [scopes] => Array
                        (
                            [0] => SCOPE,
                            [1] => SCOPE
                        )

                    [created_at] => 2015-09-05T12:50:07Z
                    [updated_at] => 2015-09-05T12:50:07Z
                )

            [user_name] => barrycarlyon
            [client_id] => [CLIENTID]
        )

    [_links] => Array
        (
            [channel] => https://api.twitch.tv/kraken/channel
            [chat] => https://api.twitch.tv/kraken/chat/barrycarlyon
            [teams] => https://api.twitch.tv/kraken/teams
            [user] => https://api.twitch.tv/kraken/user
            [users] => https://api.twitch.tv/kraken/users/barrycarlyon
            [streams] => https://api.twitch.tv/kraken/streams/barrycarlyon
            [ingests] => https://api.twitch.tv/kraken/ingests
            [channels] => https://api.twitch.tv/kraken/channels/barrycarlyon
        )

)
2 Likes

what key is that the ClientID or Acces_token. It would awesome if I could get an example cause I am not doing something right.

In order to use the Twitch API you need to authenticate via header as noted here: https://dev.twitch.tv/docs

Above I just did I normal API request against the root /kraken/ end point.

I send both the clientID and the authentication token.

After authorizing the account and getting the access token and running a curl to https://api.twitch.tv/kraken and seeing channel subscription under scope and then running the curl to https://api.twitch.tv/kraken/channels/{channel}/subscriptions i am getting a 403 Forbidden.

What am I doing wrong?

You can only pull subscriptions from channels that have authorized you to do so via scope. Do you have the proper scope for those channels in question? That is the channel owner authorized your client ID for their channel?

Although, you might also get back:
{“error”:“Unauthorized”,“status”:401,“message”:“Token invalid or missing required scope”}

Can you pull other endpoints for channels that do not require scope?

Thanks! Exactly what I looked for :slight_smile:

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