Skip to content

Instantly share code, notes, and snippets.

@m-Phoenix852
Created August 26, 2020 07:45
Star You must be signed in to star a gist
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);
@msr8
Copy link

msr8 commented Jul 14, 2022

Its working for me, how are you sure that its a correct token @Milloper ?

@monkaMC
Copy link

monkaMC commented Jul 15, 2022

for me its working not aswell.

@msr8
Copy link

msr8 commented Jul 15, 2022

It worked for me. Remember, discord regenerated and changed the token generation a while back and the process to getting it is different now

@FerretBoiX
Copy link

Discord changed it so you get a one time token every time you login, so you have to be connected to the token somewhere else already for it to work

@SuperHarmony910
Copy link

https://www.androidauthority.com/get-discord-token-3149920/

this seems to work for me in conjunction with the script

@SuperHarmony910
Copy link

also, the first few characters of the localStorage token value, before the colon for me, is the id for never gonna give you up lmao

@xavierskids
Copy link

yall are just retarded

@crowwd
Copy link

crowwd commented Aug 21, 2022

yall are just retarded

“joined 5 days ago”

@SuperHarmony910
Copy link

yall are just retarded

lmao stfu kid

@AamrZahid
Copy link

i cant login aswell. This is the error message:
discord.client: logging in using static token
discord.gateway: Shard ID None has connected to Gateway

if someone have the solution please

@NOFY96
Copy link

NOFY96 commented Sep 17, 2022

i cant login any tokken from this script

@T0talInsan1ty
Copy link

I have been using this token login script for nearly a year now with no issues. However, over the past month or so I have been having the same issue as everyone else here.

You use the token to login, it proceeds to try to login, goes temporarily to discord.com/app but then refreshes back to the login page as if nothing happened.

And yes, I checked to make sure the tokens are right. Really not sure what is causing this.

@stretch07
Copy link

just a note to everyone: you can get your token by completing an action such as sending a message, going to the network panel, going to the lowest entry, and getting the authentication or authorization (can't remember which) header from the REQUEST HEADERS(!)

@xavierskids
Copy link

its mad easy yall just retarded use your brain lmao

@Aking54
Copy link

Aking54 commented Oct 3, 2022

Show us then.

@SuperHarmony910
Copy link

SuperHarmony910 commented Oct 4, 2022

just a note to everyone: you can get your token by completing an action such as sending a message, going to the network panel, going to the lowest entry, and getting the authentication or authorization (can't remember which) header from the REQUEST HEADERS(!)

this code also works, also copies it to your clipboard:

window.webpackChunkdiscord_app.push([
  [Math.random()],
  {},
  req => {
    for (const m of Object.keys(req.c)
      .map(x => req.c[x].exports)
      .filter(x => x)) {
      if (m.default && m.default.getToken !== undefined) {
        return copy(m.default.getToken());
      }
      if (m.getToken !== undefined) {
        return copy(m.getToken());
      }
    }
  },
]);
console.log('%cWorked!', 'font-size: 50px');
console.log(`%cYou now have your token in the clipboard!`, 'font-size: 16px');

@stretch07
Copy link

yep it does, but I'm not quite used to webpackChunkdiscord_app

@UltraBlackLinux
Copy link

thanks for this. Discord has been really stupid and doesn't allow me to change my email. This is good for the time being after I extracted the seemingly never expiring token from the app

@SuperHarmony910
Copy link

yep it does, but I'm not quite used to webpackChunkdiscord_app

same heree...

@stretch07
Copy link

@SuperHarmony910 man I wish someone would document this. Also is the copy function defined in internal discord?

@TriNotNight
Copy link

Is this supposed to work when pasting in console ?

@UltraBlackLinux
Copy link

Is this supposed to work when pasting in console ?

yeah, but you can also add that into a bookmark on firefox

@RRTropical
Copy link

Yeah nah, doesn't work anymore

@UltraBlackLinux
Copy link

I use it daily. It works.

@UltraBlackLinux
Copy link

It literally does. No clue what you are doing.

Are you trying this in the web app or the desktop client? Web works for me, and I haven't tested the app

@xavierskids
Copy link

xav#0666 for help

@stretch07
Copy link

yall are just retarded
use your brain
xav#0666 for help

@xavierskids no one is going to ask you for help lmfao

@lafkpages
Copy link

Does not work for me, it just signed me out of all accounts. Seems like the token store does no longer exist because of Account Switcher, so this script no longer works.

@UltraBlackLinux
Copy link

Still works (on the web client at least). I don't get why you are all having issues, it works like a charm.

@Techpro709
Copy link

I know that for me, I have to put the token into the webclient and then spam the command as in this README file

https://github.com/passedout/Discord-Token-Login-Script#discord-token-login-script

@vsamavila
Copy link

Have been trying everything on this thread and can't get a single login to work

@UltraBlackLinux
Copy link

y'all are using invalid tokens lmao

@RealHeha
Copy link

RealHeha commented Jan 2, 2023

it doesnt work lol

@Techpro709
Copy link

Works for me

I know that for me, I have to put the token into the webclient and then spam the command as in this README file

github.com/passedout/Discord-Token-Login-Script#discord-token-login-script

@RakonR
Copy link

RakonR commented Jan 8, 2023

Doesn't work

@MisterBullet
Copy link

nah none of this shit is working for me

@DumbGameMaker
Copy link

DumbGameMaker commented Jan 13, 2023 via email

@SuperHarmony910
Copy link

Please stop emailing me github (it isnt letting me unsubscribe)I've been getting 12 year old kids trying to hack their friends emailing me since pandemic started...Sent from my iPhoneOn Jan 12, 2023, at 8:46 PM, MisterBullet @.> wrote:Re: @. commented on this gist.nah none of this shit is working for me—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you commented on the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.

...open the webpage on computer if you can since it's obv not working for you on phone, and press the button in the top right that says Unsubscribe- is it really that hard to figure it out for yourself bro

@TruongDinhDTri
Copy link

It doesn't work anymore guys. I check the dev tools an saw that each time you paste the token in and refresh instead of it log you in it redirect you back to the login page. Each time you refresh even if you paste the token in the "local storage" but if you refresh it will automatically run another thing it's
+-----------------+---------------------------------+
| tokens | {"user_id_cache": "your token"} |
+-----------------+---------------------------------+
| user_id_cache: | "your_user_id" |
-------------------+---------------------------------+
| token | "your_token" |
+-----------------+---------------------------------+
But even i paste these two value in, each time you reload it just empty the token --> refresher -->
token: {} --> back to the login page

@RealHeha
Copy link

RealHeha commented Mar 11, 2023

just go to inspect > applications > local storage > discord.com, then click mobile icon on top right of inspect and search "token" in the filter then change the value to your token

@TruongDinhDTri
Copy link

TruongDinhDTri commented Mar 11, 2023 via email

@TruongDinhDTri
Copy link

please i need your help add me on discord Wiwi#0402 it’s super urgent please

It doesn't work anymore guys. I check the dev tools an saw that each time you paste the token in and refresh instead of it log you in it redirect you back to the login page. Each time you refresh even if you paste the token in the "local storage" but if you refresh it will automatically run another thing it's
+-----------------+---------------------------------+
| tokens | {"user_id_cache": "your token"} |
+-----------------+---------------------------------+
| user_id_cache: | "your_user_id" |
-------------------+---------------------------------+
| token | "your_token" |
+-----------------+---------------------------------+
But even i paste these two value in, each time you reload it just empty the token --> refresher -->
token: {} --> back to the login page

Added

@DracoGamer2
Copy link

It work

@DracoGamer2
Copy link

It works depance the pc you have, i have a cromebook and it works

@DracoGamer2
Copy link

DracoGamer2 commented Mar 23, 2023 via email

@DracoGamer2
Copy link

DracoGamer2 commented Mar 23, 2023 via email

@DracoGamer2
Copy link

DracoGamer2 commented Mar 23, 2023 via email

@Sheepasus
Copy link

Can anyone explain me how to get it work as well?

@DracoGamer2
Copy link

DracoGamer2 commented Mar 29, 2023 via email

@Sheepasus
Copy link

yeah I already got it to work, I even made it work for tokens that are 2fa verified aswell, As they require a different approach

@PrmWiny
Copy link

PrmWiny commented Mar 30, 2023

I things it work sometime

before the QR CODE LOGIN IS REFRESHING add some console command in it and wait around 120 sec for the QR CODE refreshing

boom! it's works!!!!

but not 100% work all the times i think u can do a trick in command for get it for 100% work.

image

I use this command : 👍

let token = "ur token";

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

login(token);

@Sheepasus
Copy link

the problem is the waiting period, you need to set it to 100 instead of 50, and then for me it works 99% of the time

@Sheepasus
Copy link

yeah I already got it to work, I even made it work for tokens that are 2fa verified aswell, As they require a different approach

What are you talking about 2fa it doesn't matter 2fa or not you just get in with token? Can u explain

so this code did not work for me on my alt, 2fa tokens are 70 characters whereas phone verified are like 59 characters or something, so to make it work for tokens that have 2fa verification set up, I had to use a different method. So now I use this method for 59 characters and my own method for 2fa verified tokens

@JacksonCJG
Copy link

Could someone help me with this my discords !Jackson!#5719

@opay1
Copy link

opay1 commented Apr 8, 2023

could someone help me ? my discord opay432#7032

@JakeRuCodes
Copy link

Not sure if this'll work but try this :

(function() {
let token = "YOUR_DISCORD_TOKEN";
let ws = new WebSocket("wss://gateway.discord.gg/?v=6&encoding=json");

ws.onopen = function() {
ws.send(
JSON.stringify({
op: 2,
d: {
token: token,
properties: {
$os: "Windows",
$browser: "Chrome",
$device: "Desktop",
},
},
})
);
};

ws.onmessage = function(event) {
let data = JSON.parse(event.data);
if (data.op === 10) {
let interval = data.d.heartbeat_interval;
setInterval(function() {
ws.send(JSON.stringify({ op: 1, d: null }));
}, interval);
}
};
})();

@RandomPerson54163
Copy link

None of these methods work. Can anyone pls find a solution to this.

@Techpro709
Copy link

This code works, just spam it in console and it works. Also use a working token

@JeiLys
Copy link

JeiLys commented Aug 4, 2023

please i need your help add me on discord Wiwi#0402 it’s super urgent please

It doesn't work anymore guys. I check the dev tools an saw that each time you paste the token in and refresh instead of it log you in it redirect you back to the login page. Each time you refresh even if you paste the token in the "local storage" but if you refresh it will automatically run another thing it's
+-----------------+---------------------------------+
| tokens | {"user_id_cache": "your token"} |
+-----------------+---------------------------------+
| user_id_cache: | "your_user_id" |
-------------------+---------------------------------+
| token | "your_token" |
+-----------------+---------------------------------+
But even i paste these two value in, each time you reload it just empty the token --> refresher -->
token: {} --> back to the login page

Added

Can you add me on discord for help me pls ? JeiLys.

@Techpro709
Copy link

please i need your help add me on discord Wiwi#0402 it’s super urgent please

It doesn't work anymore guys. I check the dev tools an saw that each time you paste the token in and refresh instead of it log you in it redirect you back to the login page. Each time you refresh even if you paste the token in the "local storage" but if you refresh it will automatically run another thing it's
+-----------------+---------------------------------+
| tokens | {"user_id_cache": "your token"} |
+-----------------+---------------------------------+
| user_id_cache: | "your_user_id" |
-------------------+---------------------------------+
| token | "your_token" |
+-----------------+---------------------------------+
But even i paste these two value in, each time you reload it just empty the token --> refresher -->
token: {} --> back to the login page

Added

Can you add me on discord for help me pls ? JeiLys.

I sent an invite

@mahonmc
Copy link

mahonmc commented Aug 14, 2023

does anyone know how to do it 2023 august i cant find any working tutorials and ima ure my token is positive.

@BBSFire
Copy link

BBSFire commented Aug 16, 2023

hello I would need help I lost my discord account and the A2F is connected to it despite the fact that I have sent several times emails to discore they do not want to help me recover it could help me please please

@apricotwtf
Copy link

apricotwtf commented Sep 23, 2023

document.body.appendChild(document.createElement("iframe")).contentWindow.localStorage.setItem("token", "\"token.here\"");
setTimeout(() => location.reload(), 1000);

should work :D

@wolfy402
Copy link

could I get some help pls?

@m8cx
Copy link

m8cx commented Oct 29, 2023

could I get some help pls?

do you suffer from the stupid @wolfy402

@KyloSoot
Copy link

need help. tried every single one and none works

@m8cx
Copy link

m8cx commented Nov 9, 2023

need help. tried every single one and none works

are you acoustic

@Heroscarman
Copy link

foes this still work? and what am i supposed to run it on?

@Heroscarman
Copy link

document.body.appendChild(document.createElement("iframe")).contentWindow.localStorage.setItem("token", "\"token.here\"");
setTimeout(() => location.reload(), 1000);

should work :D

what do i run it on?

@Heroscarman
Copy link

This code works, just spam it in console and it works. Also use a working token

yo how do i do it @Techpro709

@Heroscarman
Copy link

PrmWiny

@PrmWiny what did you execute it on?

@SplashAni
Copy link

14907.0926618061b4729bc6fb.js:1 Uncaught (in promise) Error: Cannot find module './notosans-400-normalitalic.woff2'
at 14907.0926618061b4729bc6fb.js:1:1348901
at async Promise.all (index 3) it got patched

@Techpro709
Copy link

Techpro709 commented Jan 2, 2024

14907.0926618061b4729bc6fb.js:1 Uncaught (in promise) Error: Cannot find module './notosans-400-normalitalic.woff2' at 14907.0926618061b4729bc6fb.js:1:1348901 at async Promise.all (index 3) it got patched

Uhh, that seems unrelated.

Still works for me with a fresh token. Message me on discord for help.

Discord username h4f5c0d3sl1k3m4g1c

https://proton.hackclub.com/.t3ch_/

@Heroscarman @SplashAni

@Heroscarman
Copy link

@Techpro709 i sent friend request

@Heroscarman
Copy link

@Techpro709 are u lying to me

@pycharmergirl
Copy link

@Techpro709 is awesome and showed me how to do it! Still works 2024!

@Techpro709
Copy link

@Techpro709 is awesome and showed me how to do it! Still works 2024!

Thanks for that!

@jsdkfkjljfds
Copy link

@Techpro709 Thanks so much for making it work!

@oreOw1lk
Copy link

@Techpro709 tysm.

@Techpro709
Copy link

This method was patched, Noticed on 1/16/2024

@jsdkfkjljfds
Copy link

Golly dang it

@Anton9640
Copy link

This method was patched, Noticed on 1/16/2024

NOPE, the top message still works

@jsdkfkjljfds
Copy link

Like the very top?

@jsdkfkjljfds
Copy link

which one?

@Techpro709
Copy link

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);

Yep, This still works, I guess this was temporarily patched.

@jsdkfkjljfds
Copy link

it doesn't work on my chromebook cuz its too old or smt. Maybe it will work my on pc

@farzadkb
Copy link

Not work any more

@Techpro709
Copy link

Not work any more

it still works for me, sometimes it won't work if you don't do it properly.

also for some reason it doesn't work on my other PC.

@ClearlyHere
Copy link

Tokken logging is actually a thing, I've seen @Techpro709 do it with a random token and he did it, quite surprised me

@jsdkfkjljfds
Copy link

jsdkfkjljfds commented Feb 26, 2024 via email

@gagedevs
Copy link

it's not because of your pc, you have to go to inspect element and then go to mobile mode, and then go to application -> local storage -> discord.com and then clear the token and tokens items. discord for some reason pulls tokens from cache sometimes, idk why

@KingSuccar
Copy link

does anyone have a discord i can add for assistance, i am doing it on mac btw. Add me SHMEXY BEAST#0652

@S0dxu
Copy link

S0dxu commented Mar 23, 2024

patched?

@MateusRyder
Copy link

patched

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