How to get accessToken for use 'New Twitch API'?

Hello, all

I testing to get information by ‘New Twitch API’.
But, I found only that I have didn’t understand about token.

I used returned token in authentication for using ‘New Twitch API’.
There is two token in return value of authentication (accessToken, refreshToken).

But, I met message like below when used this token.
{“error”:“Unauthorized”,“status”:401,“message”:“Must provide valid app token.”}

Is it correct that used returned token in authentication?
Or Must I request new token for using ‘New Twitch API’?

You attempted to perform a request against an API end point that requires an App Token.

App Token’s can be obtained as per the docs here:

Which end points are you trying to work with?

Thank you for your answer.
I have a question.

I tested as access_token in ’ OAuth Client Credentials Flow’.

var gettokenURL = ‘<%=config.clientID%>&client_secret=<%=config.clientSecret%>&grant_type=client_credentials&scope=channel_read’;

But, I met message below.
{“error”:“Unauthorized”,“status”:401,“message”:“invalid oauth token”}

So, I got access_token in scope ‘channel_read’ by below site.
And The access_token work normally.

I don’t understand this situation.

Is fault my how to get access token?


This is wrong

As per

As mentioned earlier, app access tokens are only for server-to-server API requests. The grant request below requires the client secret to acquire an app access token; this also should be done only as a server-to-server request, never in client code.

You are requesting the WRONG token type.

You need an oAuth loop around: OAuth Authorization Code Flow

The type of token you have obtained is a “server to server” token and doesn’t support the channel_read scope, as theres no user attached to it.

Thank you for your answer always.

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