Error logging in when using token that has chat_login scope

I am having trouble logging in to IRC. I requested a token with the chat_login scope using the client credentials flow as described here:

I am also prepending my token with “oauth:” when sending it. However I am getting “NOTICE Error logging in” after attempting to log in.

It does work when I generate a token with the OAuth password generator (https://twitchapps.com/tmi/). However, I would like to generate the token with the authentication API so that I can regenerate it when it expires.

So you did all the steps?

Send yourself to twitch.
Accept,
Use the code returned in the GET variable to exchange for a Token?

Just want to check that you did all the steaps.

Currently they don’t expire.

Not exactly sure what you mean. But here’s the request I sent:

POST https://api.twitch.tv/kraken/oauth2/token
?client_id=my_client_id
&client_secret=my_client_secret
&grant_type=client_credentials
&scope=chat_login

It responded with 200 and an access code in the body, which I used to tried to log in.

You requsted as “OAuth Client Credentials Flow (App Access Tokens)”

You need a “OAuth Authorization Code Flow (User Access Tokens)”

3) 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>

Ah. I thought it would work with client credentials. But this makes more sense. I got it to work now. Thanks

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