# Chatbot IRC runs only with TMI-Generator Key

**URL:** <https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131>\
**Category:** Chat and IRC\
**Created:** [November 17, 2020, 10:50am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131 "2020-11-17T10:50:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muetze](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/muetze/32/10411_2.png) [@Muetze](https://discuss.dev.twitch.com/u/Muetze)\
**Post date:** [November 17, 2020, 10:50am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131/1 "2020-11-17T10:50:37Z")

</div>

Hi,

I use a customized version of the chat bot script from Twitch Docs:

> **[Chat & Chatbots](https://dev.twitch.tv/docs/irc/)**
>
> Twitch Chat & Chatbots

If I use the token generator linked on the page, the bot works without problems:  
[https://twitchapps.com/tmi/](https://twitchapps.com/tmi/)

But if I get the token with my own Auth and use it, I can’ t log in with them. I get the error “error: Login unsuccessful”.

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [November 17, 2020, 11:02am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131/2 "2020-11-17T11:02:21Z")

</div>

Which auth flow are you trying to use?

If you’re using the Implicit auth flow you should get a token in the URL hash. With the Auth Code flow you get a code which you must exchange for access and refresh tokens. And the Client Credentials flow is for App tokens, which are not usable for connecting to chat with as they don’t represent a user.

---

<div class="post-metadata">

**Author:** ![Muetze](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/muetze/32/10411_2.png) [@Muetze](https://discuss.dev.twitch.com/u/Muetze)\
**Post date:** [November 17, 2020, 11:32am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131/3 "2020-11-17T11:32:52Z")

</div>

I user Laravel Socialite. This usa as auth is [https://id.twitch.tv/oauth2/authorize](https://id.twitch.tv/oauth2/authorize) and as token url [https://id.twitch.tv/oauth2/token](https://id.twitch.tv/oauth2/token).  
I get token, refreshToken, expiresIn, id, nickname, name, email, avatar and user data.

Refreshing the token works, only the connection to the chat doesn’t.

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [November 17, 2020, 11:36am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131/4 "2020-11-17T11:36:54Z")

</div>

Does the token have the appropriate scopes for the chat functionality you’re after? such as `chat:read` if you want to read chat.

---

<div class="post-metadata">

**Author:** ![Muetze](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/muetze/32/10411_2.png) [@Muetze](https://discuss.dev.twitch.com/u/Muetze)\
**Post date:** [November 17, 2020, 11:41am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131/5 "2020-11-17T11:41:45Z")

</div>

Ahh. Thanks. I’m so stupid sometimes.

I only checkede the scopes from the first table…

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

No. It’s works. Thank You.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [December 17, 2020, 11:41am UTC](https://discuss.dev.twitch.com/t/chatbot-irc-runs-only-with-tmi-generator-key/29131/6 "2020-12-17T11:41:49Z")

</div>

Closed on December 17, 2020, 11:41am UTC

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