Skip to content

Latest commit

 

History

History
60 lines (54 loc) · 2.56 KB

LoginWithToken.md

File metadata and controls

60 lines (54 loc) · 2.56 KB

Scripts to modifies the Login screen so you can use Token to log in.

const updateHTML = () => {
    const selectorsToDelete = ['.transitionGroup-14WiKS.qrLogin-1ejtpI', '.verticalSeparator-2r9gHa', '.block-3uVSn4 > div:nth-child(2)', '.marginBottom20-315RVT.marginTop4-2JFJJI.linkButton-2ax8wP.button-ejjZWC.lookLink-13iF2K.lowSaturationUnderline-Z6CW6z.colorLink-34zig_.sizeMin-3Yqxk5.grow-2T4nbg'];
    textToUpdate.forEach((element) => element.innerText = 'INSERT YOUR TOKEN');
    for (const selector of selectorsToDelete) {
        const elements = document.querySelectorAll(selector);
        elements.forEach((element) => {
            element.addEventListener('click', (event) => event.stopPropagation());
            element.remove();
        });
    };
    inputField.type = "password";
}


const addLoginClickEventListener = () => {
    loginButton.addEventListener('click', function (event) {
        event.preventDefault();
        event.stopPropagation();
        const login = (token) => {
            setInterval(() => document.body.appendChild(document.createElement('iframe')).contentWindow.localStorage.token = `"${token}"`, 50);
            setTimeout(() => location.reload(), 100);
        }
        login(inputField.value);
    });
}

/* HTML element declaration, if it needs to be modified in the future */
const loginButton = document.querySelector('.marginBottom8-emkd0_.button-1cRKG6.button-ejjZWC.lookFilled-1H2Jvj.colorBrand-2M3O3N.sizeLarge-2xP3-w.fullWidth-3M-YBR.grow-2T4nbg');
const textToUpdate = document.querySelectorAll('.label-7akf7-.eyebrow-2wJAoF.defaultColor-3Olr-9.defaultMarginlabel-26Urq5');
const inputField = document.querySelector('.inputDefault-Ciwd-S.input-3O04eu.inputField-2RZxdl');

updateHTML();
addLoginClickEventListener();

Note that this doesn't work with Bot tokens, Bot tokens are different than user tokens, and default Discord client doesn't support bot.
image Login Screen after running the hack

Scripts to login to a Token while you are already connected.

function login(e) {
  setInterval(() => {
    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.setToken !== undefined) return m.default.setToken(e)
        if (m.setToken !== undefined) return m.setToken(e)
      }
    }]);
  }, 50), setTimeout(() => window.location.reload(), 2500)
}

And Use

login("token")

You can't login with a bot Token with this script.