Login unsuccessful for ComfyJS.Init with twitch user and oauth code

Hello ! :slight_smile:

After being successful by getting an oauth code, I copy this one and paste it into the “ComfyJS.Init” function of ComfyJS, which is a Twitch Chat Module made with JS.
Here is the github url : GitHub - instafluff/ComfyJS: Comfiest Twitch Chat Library for JavaScript | NodeJS + Browser Support

ComfyJS.Init('duckenscott', 'oauth:[oauth-code]');

But the thing is, after enter my twitch user account and the oauth code, I get an error into my console which says : [17:17] error: Login unsuccessful

I’m wondering if I get the proper oauth code for this module, I try with the “OAuth implicit code flow” and the " OAuth authorization code flow" but the result is the same…

Thank you by advance for your awesome help ! :slight_smile:

Does the user oAuth token have the relevant chat scopes attached to it?

1 Like

The url I have enter to get the oauth token is this one :

https://id.twitch.tv/oauth2/authorize?client_id=[my-client-id]&redirect_uri=http://localhost&response_type=token&scope=channel:read:redemptions%20user:read:email

There are no chat scopes on that token.

So the token is not valid to connect to chat

See the following for chat scopes

1 Like

Okay so I insert all the chat scope that I need and it work perfectly thank you so much !

Last question : How many time the token will be valid ? Do I have to regenerate an other one like every 3 months for example ?

Thank you so much ! :slight_smile:

For connecting to chat.

The token needs to open be valid when the bot/script connects to chat.

A regular refreshable user token is generally valid for four hours, then you can use the refresh token to automatically get a new token.

If you have an implicit token, that is generally valid for 60 days. But when the token dies you have to manually get a new token.

You can check current time left on a token with the validate endpoint

1 Like

Ok thank you very very much for your reactivity and all those precisions, thank you ! :slight_smile:

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