Token generated just before is invalid

Hi, I have a problem with a script that worked fine until a few days ago.
Basically I refresh the access_token, insert it in the header of the request and Twitch replies that it is not valid.


immediately after

Validate endpoint uses

curl -H "Authorization: OAuth <access token>" https://id.twitch.tv/oauth2/validate

not client ID and bearer

1 Like

And heres the documentation for that endpoint

I entered both the ClientID and the (just generated) Bearer Token,
The same combination until yesterday it worked

{
    "error": "Unauthorized",
    "status": 401,
    "message": "Client ID and OAuth token do not match"
}

To which endpoint are you attempting to call? Show your call please.

The error would suggest you specified the wrong clientID or something else is invalid in your call

Sorry, https://api.twitch.tv/helix/subscriptions?broadcaster_id=857xxx&user_id=520xxx

And the oAuth token is of response_type token or code? IE It’s a user token and is for user_id 857xxx (no need to censor the caster/userID’s just your secret and oAuth token)

I haven’t changed the code for weeks, I have logs that show that everything was fine until yesterday, today it gives me this error. I checked the ClientID etc …

My calls to the subscribers endpoint are working as expected, so feels like something your side.

Recheck your logic to make sure you are using the right token, of the right type and using the right client-id, just to be sure

https://api.twitch.tv/helix/subscriptions?broadcaster_id=85756815&user_id=520026237

The token comes from a refresh request made for that user with a client_id created in the user’s “dev session”.

I checked everything, the last thing left for me to do and disconnect the app from twitch and generate a new pair of keys.
But it seems strange, that Twitch generates the token for me without allowing me to use it.

If everything is correct and as it should be, and yet you are still getting

I have no idea what the issue could be.

Regenerating the codes with a new authorization fixed the problem.

1 Like

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