Improperly formatted auth

My code does not work but i do not why it is not working:
const tmi = require(‘tmi.js’);
require(‘dotenv’).config({path: __dirname + ‘/.env’})
const client = new tmi.Client({
options: { debug: true },
connection: {
secure: true,
reconnect: true
identity: {
username: ‘your_username’,
password: process.env.TWITCH_OAUTH_TOKEN
channels: [‘grafkartoffel_yt’]
client.on(‘message’, (channel, tags, message, self) => {
if(self) return;
if(message.toLowerCase() === ‘!marco’) {
client.say(channel, Polo!);

Chat login via IRC/TMI requires the oAuth token to be prefixed by oauth:

So if your token is foobarbaz for chat the password is oauth:foobarbaz

[quote=“BarryCarlyon, post:2, topic:56787”]
n is foobarbaz for chat the password is `oauth:fo
I think i have an other problem:
[UnhandledPromiseRejection: 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(). The promise rejected with the reason “Improperly formatted auth”.] {
This was the error

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