ncee
September 16, 2017, 6:44pm
1
Hello,
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
george
September 16, 2017, 7:40pm
2
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
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>
&grant_type=authorization_code
&redirect_uri=<your registered redirect URI>
Here is a sample request:
POST https://api.twitch.tv/kraken/oauth2/token
?client_id=uo6dggojyb8d6soh92zknwmi5ej1q2
&client_secret=nyo51xcdrerl8z9m56w9w6wg
&code=394a8bc98028f39660e53025de824134fb46313
&grant_type=authorization_code
&redirect_uri=http://localhost
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)>
}
ncee
September 16, 2017, 8:54pm
3
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…