I made a server side script to get channel details (and more in the future).
Step 1 : I generate a new OAuth token with the channel_read scope. Everything is fine, when I debug the response, I got the token, valid at true, my client id, and a expires_in data.
Step 2 : I hit the /channel endpoint, with the Authorization header and the token given. But I got a “invalid oauth token” response.
The token was just generated, how it’s possible to have a invalid one ?
Have you tried sending a request to the root kraken domain, ie https://api.twitch.tv/kraken as that’ll respond with the validity and scopes of the token so is a good way check the status of the token.
In fact, I don’t need the oauth key provided by this endpoint (server->server).
I’ve generated a auth key with this website : https://twitchtokengenerator.com
And the script works well with the given oauth token. My script juste refresh the token to be sure it is not expired.
Yeah, for future reference for anyone else who may run into this and want to get tokens themselves rather than use 3rd party sites like that to get tokens for you, you need to get a User token rather than an App token.
App tokens are for server to server requests that are NOT associated with a user (and and such can not be used on endpoints that require user authentication, as the the channel endpoint mentioned in this thread).