Ircv3 ERROR Disconnected unexpectedly: [1006]

I am trying to make a bot for my twitch channel so i can do some things with arduino’s and the twitch api but the thing is that when i connect to my channel this happens

[2021-08-05T09:21:22.290Z] ❌ ircv3 ERROR Disconnected unexpectedly: [1006]
[2021-08-05T09:21:24.101Z] ⚠️  twitch-chat WARNING No valid token available; trying to refresh
(node:7636) UnhandledPromiseRejectionWarning: InvalidTokenError: Invalid token supplied
(node:7636) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see (rejection id: 16)

how can i fix this because i have a valid token but it says that i dont have a valid token

I am using the node js api

this is the source code

// Require statements
const { StaticAuthProvider } = require('twitch-auth');
const { ChatClient } = require('twitch-chat-client');
const config = require('./config.json');

// twitch api request thingies
const clientId = config.clientId;
const accessToken = config.accessToken;
const auth = new StaticAuthProvider(clientId, accessToken);
const chatClient = new ChatClient(auth, { channels: ['jop1481'] });

// random code
chatClient.onMessage((channel, user, message) => {
	if (message === '!ping') {
		chatClient.say(channel, 'Pong!');
	} else if (message === '!dice') {
		const diceRoll = Math.floor(Math.random() * 6) + 1;
		chatClient.say(channel, `@${user} rolled a ${diceRoll}`)


The error indicates an invalid token, have you checked the Validate Token endpoint to make sure it is not expired and has the correct scopes?

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