Attention: This post is for educational purposes only. I highly advise you to respect Discord’s guidelines. Never share your token with anyone for any reason whatsoever. Do not run bots under a user account, bot accounts exist for a reason.

How it works

For quite a while Discord has added two measures to stop people from easily getting their Discord token, those are:

  1. Removing it from local storage as soon as the page is loaded
  2. Removing the localStorage window property

We use two tricks to circumvent these measures:

  1. Reloading the page, so that the token is still there
  2. Adding an iframe and using its localStorage (thanks Stackoverflow)

Code

location.reload();
var i = document.createElement('iframe');
document.body.appendChild(i);
alert(i.contentWindow.localStorage.token);

Edit: A commenter suggested adding stop(); before the alert( line to fix issues in Firefox.

Bookmarklet

Drag this into your bookmark bar: Obtain Discord Token or this, for the fixed version for Firefox: Obtain Discord Token

In case you are using Chrome mobile, you can create a new bookmark for a page of your choice, open the bookmark list, tap on “edit” on the bookmark you just created and then insert javascript:(function()%7Blocation.reload()%3Bvar%20i%20%3D%20document.createElement('iframe')%3Bdocument.body.appendChild(i)%3Balert(i.contentWindow.localStorage.token)%7D)() as URL and insert a name you want.

In Edge you can right click the link and add it to your reading list.

Thanks to https://mrcoles.com/bookmarklet/ for the awesome bookmarklet generator.

Image: https://pixabay.com/photos/door-blue-rusty-entrance-wood-old-1587863/


5 Comments

nitin ojha · 11th August 2021 at 05:24

what is a bookmark bar?

Gabriel · 3rd April 2020 at 04:37

I’m kind of stupid, so I don’t understand how to do it (no video)

    Himbeer · 3rd April 2020 at 12:32

    Chances are, if you don’t understand it, you shouldn’t try it either.

Anonym · 17th December 2019 at 12:42

The above code won’t work in Firefox.
Use this instead (just copy it in the bookmark as link):

javascript:(function(){location.reload();var i = document.createElement('iframe');document.body.appendChild(i);stop();alert(i.contentWindow.localStorage.token);})()

    HimbeersaftLP · 17th December 2019 at 19:28

    Thank you for your tip, I have never tested this in Firefox so I sadly didn’t notice that it doesn’t work. I have edited my post to include your advice.

Leave a Reply