Struggling with OAuth - Login unsuccessful

I’m trying to authenticate my bot, I’m using the tmi.js library.
I get my token from https://id.twitch.tv/oauth2/token and I ask for the chat:read and chat:edit scopes.
This returns ok as it should.
I move on to validate this token via https://id.twitch.tv/oauth2/validate
This again returns ok as it should, so the access token should be good right?
I pass the token to tmi.js with oauth: prepended to it like you’re supposed to. I have logged this value every step of the way to make sure it arrives correctly, which it does, so there MUST be something wrong with the token during my validation process.
The issue is not with the connection options in tmi.js because when I pass an oauth token granted by the generator it connects just fine.
I want to move away from the generated token as I need the experience, and will need this for more things than tmi.js can provide for me along the line.

Any help with what could possibly be going wrong will be hugely appreciated.
Thanks.

Sounds like you applied for a Client Credentials

instead of a User Token

Did this return the user_id of your Bot in the response?

With grant_type=client_credentials or &response_type=code ?

The former won’t work for logging into Chat

Step one of “bot/user” oAuth involves redirecting the user to Twitch where they accept/decline the link between the Twitch account and your ClientID/Application

1 Like

Ah. Thank you. You pointed out a misconception I had.

Problem solved.

Thank you.

1 Like

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