# Bot username not working

**URL:** <https://discuss.dev.twitch.com/t/bot-username-not-working/21643>\
**Category:** API\
**Created:** [June 27, 2019, 7:45am UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643 "2019-06-27T07:45:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sollazzo08](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sollazzo08/32/6617_2.png) [@sollazzo08](https://discuss.dev.twitch.com/u/sollazzo08)\
**Post date:** [June 27, 2019, 7:45am UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/1 "2019-06-27T07:45:09Z")

</div>

I have given a name for my bot inside index.js under “username: ” When I run the code my bot connects to the twitch channel but with the name of my twitch account and not the actually name I gave it under “username: ”

Btw I am creating the bot using tmi.js and node.js

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 27, 2019, 9:35am UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/2 "2019-06-27T09:35:40Z")

</div>

Show your code with secrets removed.

You did fetch a oAuth for your botname and have actually created botname as an account?

---

<div class="post-metadata">

**Author:** ![george](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/george/32/120_2.png) [@george](https://discuss.dev.twitch.com/u/george)\
**Post date:** [June 27, 2019, 10:55am UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/3 "2019-06-27T10:55:48Z")

</div>

To connect to chat has `botusername` you will need to:

1. Create a new Twitch account named `botusername`
2. Login to the new account
3. Generate an OAuth token while logged into `botusername`
4. Use that token in your script

---

<div class="post-metadata">

**Author:** ![sollazzo08](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sollazzo08/32/6617_2.png) [@sollazzo08](https://discuss.dev.twitch.com/u/sollazzo08)\
**Post date:** [June 27, 2019, 3:56pm UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/4 "2019-06-27T15:56:06Z")

</div>

No I did not do that actually. I just got the oAuth from my main twitch account. So does this mean when I make a new twitch account for my bot that whatever name I give that twitch account I will be stuck with that name for my bot? or will I be able to change the name around in the index.js file? because when I used my own Auth for what ever reason even when I changed username around it never changed

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 27, 2019, 4:11pm UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/5 "2019-06-27T16:11:50Z")

</div>

> [@sollazzo08](#):
>
> No I did not do that actually. I just got the oAuth from my main twitch account. So does this mean when I make a new twitch account for my bot that whatever name I give that twitch account I will be stuck with that name for my bot?

Yes

> [@sollazzo08](#):
>
> or will I be able to change the name around in the index.js file?

Usernames can be changed every 3 months iirc.

Otherwise to change the name of your bot, you will need to make a new Twitch account and go thru the oAuth loop with that Twitch Account.

> [@sollazzo08](#):
>
> because when I used my own Auth for what ever reason even when I changed username around it never changed

The bot can only authenticate using the password you used. The “password” is the oAuth. The oAuth belongs to you (in this case) so your JS file/Bot can only connect to chat “as you”

To login as another user, you need to create another account and perform an oAuth loop to get an oAuth for the other user.

---

<div class="post-metadata">

**Author:** ![sollazzo08](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sollazzo08/32/6617_2.png) [@sollazzo08](https://discuss.dev.twitch.com/u/sollazzo08)\
**Post date:** [June 27, 2019, 4:15pm UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/6 "2019-06-27T16:15:44Z")

</div>

Oh ok makes sense ! 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:** [July 27, 2019, 4:15pm UTC](https://discuss.dev.twitch.com/t/bot-username-not-working/21643/7 "2019-07-27T16:15:49Z")

</div>

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