Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!