Mysterious Client ID and No Clue How to Access Secret

Hello, I’m a hobbyist programmer here making a chatbot. While trying to fix the issues the Helix API updates causes, I tried to do any request, it failed with a status code 401. If I were to use curl with this command:

curl -H 'Authorization: Bearer aaaaaaaaaaaaaaaa' -H 'Client-ID: e3ir6poyf6tbmrq6ag23bfwk29gbth' -X GET 'https://api.twitch.tv/helix/users?id=44322889'

…it would say “Client ID and OAuth token do not match.”

If I were try and validate my token: I get this;

$ curl -H 'Authorization: OAuth aaaaaaaaaaaaaaaa' -X GET https://id.twitch.tv/oauth2/validate
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0    638      0 --:--:-- --:--:-- --:--:--   638{"client_id":"gp762nuuoqcoxypju8c569th9wz7q5","login":"jimruswick","scopes":["bits:read","chat:edit","chat:read","whispers:edit","whispers:read"],"user_id":"263102519","expires_in":0}

I found a client ID (gp762nuuoqcoxypju8c569th9wz7q5) that’s different then the one I have previously. Weird. If I were to use that as my client ID however…

$ curl -H 'Authorization: Bearer aaaaaaaaaaaaaaaaa' -H 'Client-ID: gp762nuuoqcoxypju8c569th9wz7q5' -X GET 'https://api.twitch.tv/helix/users?id=44322889'                % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100   417  100   417    0     0   1688      0 --:--:-- --:--:-- --:--:--  1688{"data":[{"id":"44322889","login":"dallas","display_name":"dallas","type":"","broadcaster_type":"affiliate","description":"Friendly, interactive, and very bald.","profile_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/4d1f36cbf1f0072d-profile_image-300x300.png","offline_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/51737668f60f7dcc-channel_offline_image-1920x1080.png","view_count":37585}]}

Everything works, now, huh. However, if I were to login to my developer account, I wouldn’t see that client ID there. My bot account didn’t have anything useful either.

Considering that I got completely and utterly confused by the whole API update, and seeing that refreshing a token would need a secret or something like that in the future, I figured that solving that now might be a good idea. I have full access to my chatbot’s account, full access to my own dev account, but no clue where the client ID came from, and even less so the secret. If I am not able to figure out where it is, would it be possible to change the client ID? Or am I missing something entirely.

Thanks for taking the time to read! (hopefully I didn’t butcher the formatting)

EDIT: fixed formatting

How did you got your authorization token?

OAuth token? Got it from here https://twitchapps.com/tmi/

(Gunna go to sleep, its super late for me. will check back in around 8 hours ish)

That’s why, The clientId you get is the one from the app you used to generate your token.
To get it work, you should generate you own token with your clientId :slight_smile:

Oh, did you mean client ID? I got that from the dev.twitch.tv site. Used my main account instead of the bot account to create it, that might be a factor?

That client ID worked for when Twitch APIs made it required to have a client ID, and that specific ID made it work.

If I were to use that ID now, it wouldn’t work because of some mismatch according to the API.

You are generating a oauth token with another app, so another clientId
You need to use the clientId used when generating the token on your api call.

1 Like

You need to take your ClientID and your Secret

Choose an oAuth method from

Generate a token using your own website/tool.

Sounds like you made a clientID then went and generated a token using TwitchApps.
Then as Breci said you put a call into the API with the token from TwitchApps and your ClientID.

You need to create your own tool to let yourself generate your own tokens, and not use someone elses tool

1 Like

Yep, you’re all right. Managed to figure out the authentication stuff, thanks! Sorry for the late reply, stuff got busy.

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