# Error logging in when using token that has chat\_login scope

**URL:** <https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883>\
**Category:** Chat and IRC\
**Created:** [September 9, 2017, 5:58pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883 "2017-09-09T17:58:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Kutkoski](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Steven\_Kutkoski](https://staging-discuss.dev.twitch.com/u/Steven_Kutkoski)\
**Post date:** [September 9, 2017, 5:58pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883/1 "2017-09-09T17:58:40Z")

</div>

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:

> **[Apps & Authentication](https://dev.twitch.tv/docs/authentication)**
>
> Apps & Authentication

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/](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.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [September 9, 2017, 6:16pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883/2 "2017-09-09T18:16:50Z")

</div>

> [@Steven\_Kutkoski](#):
>
> I requested a token with the chat\_login scope

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.

> [@Steven\_Kutkoski](#):
>
> However, I would like to generate the token with the authentication API so that I can regenerate it when it expires

Currently they don’t expire.

---

<div class="post-metadata">

**Author:** ![Steven\_Kutkoski](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Steven\_Kutkoski](https://staging-discuss.dev.twitch.com/u/Steven_Kutkoski)\
**Post date:** [September 9, 2017, 7:07pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883/3 "2017-09-09T19:07:16Z")

</div>

> [@BarryCarlyon](#):
>
> 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.

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

POST [https://api.twitch.tv/kraken/oauth2/token](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.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [September 9, 2017, 7:14pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883/4 "2017-09-09T19:14:39Z")

</div>

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

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

```auto
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>

```

---

<div class="post-metadata">

**Author:** ![Steven\_Kutkoski](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Steven\_Kutkoski](https://staging-discuss.dev.twitch.com/u/Steven_Kutkoski)\
**Post date:** [September 9, 2017, 7:39pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883/5 "2017-09-09T19:39:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [October 9, 2017, 7:39pm UTC](https://staging-discuss.dev.twitch.com/t/error-logging-in-when-using-token-that-has-chat-login-scope/11883/6 "2017-10-09T19:39:06Z")

</div>

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