I’m implementing the authorization grant flow here to collect the user’s Twitch ID, as well as their email (if they’ve used it to create/verify their account): Getting OAuth Access Tokens | Twitch Developers
However, after the authorization screen, I’ll receive this error when redirected back to my app:
{"error": "Unauthorized", "status": 401, "message": "Client ID is missing"}
I’ve registered a developer application to use the Twitch API, with the OAuth redirect URL as something like: https://.com/callback which matches what auto populates the URL during the redirect.
This is what my auth link looks like:
https://id.twitch.tv/oauth2/authorize?client_id=<client_id>&redirect_uri=<encoded https://<domain>.com/callback>&response_type=code&scope=user%3Aread%3Aemail&state=<state>
I’ve been using this as my Token URL- but not sure if I need to append client id, client secret and grant type (authorization_code) to it (I tried and it returned the same err):
https://id.twitch.tv/oauth2/token
User URL:
https://api.twitch.tv/helix/users
Scope:
user:read:email
I’ve also tried every variation of client_id, Client-ID, client-Id etc.
there is as I saw it on a few forums (but believe client_id
is correct as that’s what’s in the dev docs).
When I follow the auth flow instructions here with curl: Getting OAuth Access Tokens | Twitch Developers , it does return:
{"access_token":"<access_token>","expires_in":14843,"refresh_token":"<refresh_token>","scope":["channel:manage:polls","channel:read:polls"],"token_type":"bearer"}