Last active
June 5, 2024 17:18
-
-
Save Caltrop256/349f399a59e8035d17205ba6d9d4c295 to your computer and use it in GitHub Desktop.
Gets your discord user token and stores it. Paste this code into the console, make sure you have cache disabled (network -> disable cache)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Promise(function (resolve) { | |
const iframe = document.createElement('iframe'); | |
window.document.head.append(iframe); | |
const pd = Object.getOwnPropertyDescriptor(iframe.contentWindow, 'localStorage'); | |
Object.defineProperty(window, 'localStorage', pd); | |
iframe.remove(); | |
if (window.localStorage.__token) { | |
resolve(window.localStorage.__token); | |
} else { | |
window.__request = window.XMLHttpRequest; | |
window.XMLHttpRequest = class __Interceptor extends window.__request { | |
constructor() { | |
super(...arguments); | |
this._reqHead = this.setRequestHeader; | |
this.setRequestHeader = function (name, body) { | |
this._reqHead(name, body); | |
if (name === "Authorization") { | |
window.localStorage.__token = body; | |
window.XMLHttpRequest = window.__request; | |
delete window.__request; | |
resolve(body); | |
} | |
}.bind(this); | |
}; | |
}; | |
alert("Please switch channel to obtain token!"); | |
} | |
}).then(function (token) { | |
console.log('Token:', token) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment