[SOLVED] Can't get 'chat_login' scope working


I am trying to figure out why I can’t get chat_login scope to work for me.

My current setup is i set ‘chat_login’ under ‘Extension Capabilities’ in the ‘Required Broadcaster Abilities’ field.

Then when I go to test my extension and activate it, it prompts me with the oauth flow in which i authorize it and successfully receive the code on the EBS side in a format like below:

{ code: ‘some token’,
scope: ‘chat_login’,
state: ‘{“version”:“0.0.1”,“channel_id”:somechannelid}’ }

Then I send my oauth receipt as defined here → Extensions Reference | Twitch Developers

which i get a 204 status code and the window closes successfully and the extension gets activated.

The problem:

I tried using this token to authenticate via irc and it returns → :tmi.twitch.tv NOTICE * :Login authentication failed

The following commands I entered to test this was (also tried ssl):

telnet irc.chat.twitch.tv 6667
PASS oauth:mytoken
NICK myusername

but using the same commands above…when I used Twitch’s Oauth Token Generator it was successful-> Twitch Chat Password Generator

The token from that generator worked but when getting a token through extensions oauth scopes, it would not work for me.

Any ideas?

Thank you

1 Like

You must complete steps 3 and 4 of the OAuth Authorization Code Flow to turn the code to an access_token: https://dev.twitch.tv/docs/authentication#oauth-authorization-code-flow-user-access-tokens

  1. On your server, get an access token by making this request:
POST https://api.twitch.tv/kraken/oauth2/token
    ?client_id=<your client ID>
    &client_secret=<your client secret>
    &code=<authorization code received above>
    &redirect_uri=<your registered redirect URI>

Here is a sample request:

POST https://api.twitch.tv/kraken/oauth2/token
  1. We respond with a JSON-encoded access token. The response looks like this:
   "access_token": "<user access token>",
   "refresh_token": "<refresh token>",
   "expires_in": <number of seconds until the token expires>,
   "scope": <your previously listed scope(s)>

Awesome got it working, thank you very much

Side note: Whilst chat_login is perfectly fine. Most casters don’t like to grant it [citation missing]

Make sure you document exactly why you need this scope/feature, and if you can actually just use the justinfan login instead do so…