Skip to content

Instantly share code, notes, and snippets.

@m-Phoenix852
Created August 26, 2020 07:45
Show Gist options
  • Select an option

  • Save m-Phoenix852/b47fffb0fd579bc210420cedbda30b61 to your computer and use it in GitHub Desktop.

Select an option

Save m-Phoenix852/b47fffb0fd579bc210420cedbda30b61 to your computer and use it in GitHub Desktop.
Simple script to log in to discord account using token.
let token = "your token";
function login(token) {
setInterval(() => {
document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = `"${token}"`
}, 50);
setTimeout(() => {
location.reload();
}, 2500);
}
login(token);
@yum1234

yum1234 commented Dec 30, 2024

Copy link
Copy Markdown

Ok. Each time one logins with either the token or actual account credentials, the current token become invalid!!!

I compared the authorization headers after mutiple logins, and yea, they all changed.

You HAVE TO get the new token. Or else if you log out, you won't have that newly generated token.

It looks like there are some common parts for amongst each token: only the end changes. I am assuming that it may represent the timestamp of the new login, and that if you have an old token, you can simply just change that ending to make it like the new token and therefore valid to login with.

If anyone has the expertise to help that would be greatly appreciated!

@spekly

spekly commented Dec 30, 2024

Copy link
Copy Markdown

what should i change the ending of the old token to?

@pxldevv

pxldevv commented Dec 30, 2024

Copy link
Copy Markdown

Ok. I have video evidence of this script working 7 days ago on yt for some friends who needed to login by token. This does not work now. wtf?? Can anyone test it on their end? Thanks for alerting it to our attention spekly.

@Techpro709 @spekly

Sure I can test it rq

@pxldevv

pxldevv commented Dec 30, 2024

Copy link
Copy Markdown

Works perfectly fine.

@pxldevv

pxldevv commented Dec 30, 2024

Copy link
Copy Markdown
Arc_dsWIoW2hB8.mp4

@yum1234

yum1234 commented Dec 30, 2024

Copy link
Copy Markdown

If you can, try to login again with the same token; I suspect that the token got invalidated on login and discord has generated a new one

@spekly

spekly commented Dec 31, 2024

Copy link
Copy Markdown

sorry for the late reply, i have tested it again with my main and it works, i just needed to get a brand new fresh token after i send a message in console. but i think my old token is a bit too old and wont work.

@pxldevv

pxldevv commented Jan 2, 2025

Copy link
Copy Markdown

Here's the thing about tokens, tokens are device specific, so if you have a token it is the session of one of your clients (maybe your web browser or one of your PCs) and since each session has a different token, if that session clicks log out or is force logged out, that token is invalidated. You can log out all tokens by changing your password aswell as adding certain security measures such as 2fa

@bszura

bszura commented Jan 12, 2025

Copy link
Copy Markdown

can anyone help me? I wrote this code and in the console I get this:
Wait!
Sentry.06d44c857138cf37dfaa.js:14 If someone told you, if someone did something and pasted it here, there is an 11/10 chance that you will be scammed.
Sentry.06d44c857138cf37dfaa.js:14 Pasting anything here may give others access to your Discord account.
Sentry.06d44c857138cf37dfaa.js:14 Until you know exactly what's dangerous, close the window and stay safe.
Sentry.06d44c857138cf37dfaa.js:14 If you know what you like, welcome to work for us https://discord.com/jobs

@khanji-ideas

Copy link
Copy Markdown

if it won't let you paste try typing "allow pasting"

@bszura

bszura commented Jan 13, 2025

Copy link
Copy Markdown

I can only paste it, when I paste it and press enter, it starts loading and suddenly this message appears, I sent it to you earlier

@pxldevv

pxldevv commented Jan 13, 2025

Copy link
Copy Markdown

@bszura If you'd like I can walk through it with you on discord.

@pxldevv

pxldevv commented Jan 13, 2025

Copy link
Copy Markdown

If anyone wants help, I'll help you in this discord server.

https://discord.gg/dqMrD4QZgM

@bombshell209

bombshell209 commented Jan 15, 2025

Copy link
Copy Markdown

Thanks @pxldevv! You helped so much! @eveyone get the best help on their discord https://discord.gg/dqMrD4QZgM

@DuhhMikey

Copy link
Copy Markdown

hey bro im trying this and like it was working till towmorror but not wen ever i try to login through the token it just send me back to discord login page pls help man and i think its some discord api shit and ive send you friend request pls accept it my Discord username is r4aze_

@pxldevv

pxldevv commented Feb 20, 2025

Copy link
Copy Markdown

@DuhhMikey i didn't get a friend request, but if you join the server I can help you (most likely your token is invalid)

@pxldevv

pxldevv commented Feb 20, 2025

Copy link
Copy Markdown

(fyi discord username on my GitHub profile isn't valid anymore and I don't plan on updating it.)

@mistycalpi

Copy link
Copy Markdown

it just puts me in the login page

@prooskillloll

Copy link
Copy Markdown

guys most token stealers are malwares this one works tho

@pxldevv

pxldevv commented Jun 15, 2025

Copy link
Copy Markdown

guys most token stealers are malwares this one works tho

This isn't a stealer...
This code is used to log into discord with an existing token.

@prooskillloll

Copy link
Copy Markdown

hmm got other plans with it

@pxldevv

pxldevv commented Jun 15, 2025

Copy link
Copy Markdown

Is that a question?

@prooskillloll

Copy link
Copy Markdown

no i have other plans with it

@pxldevv

pxldevv commented Jun 15, 2025

Copy link
Copy Markdown

Idk what else you'd want to do with it, but alright.

@kortezzzz33

Copy link
Copy Markdown

yo bro can you help me? i only get debug logs and it sends me back to discord login page pls help

@THEJON78

Copy link
Copy Markdown

pro tip: if you keep getting notifs about this and dont want them, theres a unsubscribe button at the top of the page.

@Wouze

Wouze commented Jun 24, 2025

Copy link
Copy Markdown

image

guys im getting this, what have I done wrong?
the token I used is for my bot and it is working fine, soo i guess it is not about the token, right?

let token = "yS7zW0uzMzO6h84I4MA.GbuYOLMz05sA4saZoxMTTMH.pE7yNQ_eGF08";

function login(token) {
    setInterval(() => {
      document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = `"${token}"`
    }, 50);
    setTimeout(() => {
      location.reload();
    }, 2500);
  }

login(token);

@bytequill

Copy link
Copy Markdown

@Wouze

the token I used is for my bot

Bot tokens do NOT work the same way as user tokens (have different permissions + use a "Bot" prefix in the headers) and cannot function with the discord webapp

@celunah

celunah commented Aug 1, 2025

Copy link
Copy Markdown

this script btw still works on aug 1, 2025 but it doesn't work with bot tokens, only user tokens

@pxldevv

pxldevv commented Aug 1, 2025

Copy link
Copy Markdown

this script btw still works on aug 1, 2025 but it doesn't work with bot tokens, only user tokens

Like bytequill said above, bot tokens can't function in the discord web app, just wanted to make sure that was clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment