Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
discord.js throws TOKEN_INVALID when I use the token I got from browser in discord.com

My final goal : I would like to get every single channels in every single guilds I belong to.

As a first step, created simple program that I identify that I am logged in as myself.

I first found my token via this video

In a nutshell the video instructs to get the token via

Chrome -> discord.com -> F12 -> Application -> Local Storage -> filter "token" -> click "Toggle device toolbar" -> voila

Threw it in .env as variable TOKEN=... and my index.js is implemented as followings

const Discord = require("discord.js");
const dotenv = require("dotenv");
dotenv.config();

const client = new Discord.Client({
  intents: [
    Discord.Intents.FLAGS.GUILDS,
  ]
});

client.on('ready', ()=> {
  console.log(`Logged in as ${client.user.tag}`);
});

client.login(process.env.TOKEN);

However, when I run node index.js I receive following errors

D:\SourceTree\discord.js\00_get_server_channel_list\node_modules\discord.js\src\client\websocket\WebSocketManager.js:129
    const invalidToken = new Error(WSCodes[4004]);
                         ^

Error [TOKEN_INVALID]: An invalid token was provided.

Is the token found in the video wrong? Or is there something else I am doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you are making a discord bot The token you get from that video is your user token, not your bots token. To get your bots token go to https://discord.com/developers/applications Go to your Bots Application > Bot Tab on the left > Reset Token > Copy Token

If you dont already have an application press New Application, Name it > Bot tab on the left > Build A Bot > Reset Token > Copy Token

https://www.writebots.com/discord-bot-token/ Read Through this if ur having trouble

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda