undiscord icon indicating copy to clipboard operation
undiscord copied to clipboard

How does it get the token from localstorage?

Open DanDevDan opened this issue 4 years ago • 2 comments

How does the popup get access to the local storage token? I cannot find any line in the html that would populate the local storage. Please help me understand how.

DanDevDan avatar Jan 02 '21 18:01 DanDevDan

here is the relevant code

    $('button#getToken').onclick = e => {
        window.dispatchEvent(new Event('beforeunload'));
        $('input#authToken').value = JSON.parse(popup.localStorage.token);
    };

It's parsing a JSON file, not HTML. You can see the JSON file that it is parsing by accessing the developer tools that ship with your browser and navigating to the "local storage" tab.

AirikWarren avatar Jan 10 '21 00:01 AirikWarren

I get that. But the local storage does not contain the token on Discord. But for some reason the token appears in the popup's localstorage. That's what I don't get.

DanDevDan avatar Jan 10 '21 11:01 DanDevDan