401 Client ID and OAuth token do not match Error

Hello everyone,
I know this question has been asked a gazillion amount of times. But I’m trying to use golang oauth2/clientcredentials and oauth2/twitch packages to authorize my API but I can’t seem to get pass the 401, Client ID and OAuth token do not match error. I assumed you can use the authorization process directly through the oauth2 client, and the token will refresh itself if needed, therefore I didn’t bother with doing it via HTTP requests. The go code samples also recommend the same. Can anyone tell me what’s wrong here ? I set the redirect URL to localhost:3000, and the var for the codes are hidden above.

Debug it out and see exactly what headers you are sending.

I predict that it didn’t prefix the oAuth token with Bearer TOKENHERE so the token isn’t correct. If this module is setup/updated to talk to kraken it’ll be using OAuth TOKENHERE instead

If you generated the token yourself using your own credentials, then usually a Client ID and OAuth token do not match error is from the client id header being incorrect (either missing, or incorrectly named) as a valid token but a missing, or misnamed, client id header will result in that do not match error. Ensure that the header you’re sending for client id is named Client-Id.

1 Like

Wow, first of all, thank you so much for your swift replies. I’ve checked the header I was sending. And it turns out that since I typically use the token.SetAuthHeader(request) method to set the header for my requests, I assumed that they included my Client-ID verification somewhere in there. I added the Client-ID to the header, with request.Header.Set, and it worked now! Although it would be nice if there’s a method implemented like the setAuthHeader to set both of that at once for twitch API in one method…

Anyways, can’t stress enough on how long I was trying to figure this out, thank you so so much!!!

Now… just need to figure out how to close this thread.

1 Like