Update: Since the newest Discord Update this trick doesn’t work anymore! Check out my new post here: https://blog.himbeer.me/?p=178

While you have access to the browser developer console on a PC, there is no such thing in most common mobile browsers. The token is still there though, and the possibility to run JavaScript commands is too! The things that are different are the way we run it and what we run.

The way we run it:

As many people probably already know, you can run JavaScript from the Address bar using javascript: followed by the code you want to run.

Notice: Google Chrome and some other browsers will cut the javascript: from the text when pasting it, so make sure to either add it back manually after pasting the snippet in your address bar or use the bookmarklet shown below.

What is different:

The developer console will directly show variables when entering their names, the address bar obviously won’t, so we will have to find a different way to display it.

We could just use alert() but that won’t allow us to copy it, so instead we will replace the whole website’s text with our token. For that we will first get the <body> element using document.getElementsByTagName('body')[0] (notice the [0] which selects the first (and only) body element it finds).

After we have the element we can just edit it’s content by using .innerHTML = .

The only thing that is left now is the token itself which is stored in the variable localStorage.token.

The completed code:

javascript:document.getElementsByTagName("body")[0].innerHTML=localStorage.token;
You can now copy that directly into your address bar.

Using it:

Go to any page on discordapp.com that will show a 404 error (e.g. https://discordapp.com/1) and execute the code by…

  • …pasting it in your address bar (or reading list) and pressing <Enter>.
  • …clicking the bookmarklet (on PC).
  • …entering the first letters name of the bookmarklet in the address bar until it appears (as shown in the screenshot below) and then clicking it.

Adding it as a bookmarklet:

You have to do this frequently (for whatever reason)? No problem, just add the bookmarklet by dragging this into your bookmarks (on PC, in Edge PC and mobile you can right click it and then select “Add to reading list”): Obtain Discord token, or, 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:document.getElementsByTagName("body")[0].innerHTML=localStorage.token; as URL and insert a name you want.

Thanks for reading my very first, actual blog post!

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


0 Comments

Leave a Reply