MinecraftAuth icon indicating copy to clipboard operation
MinecraftAuth copied to clipboard

Error while logging in: 400 Bad Request (Caused by email code login)

Open nikolayKeniston opened this issue 1 year ago • 5 comments

I'm using the following code from the readme, changing java to bedrock:

        HttpClient httpClient = MinecraftAuth.createHttpClient();
        StepFullBedrockSession.FullBedrockSession bedrockSession = MinecraftAuth.BEDROCK_DEVICE_CODE_LOGIN.getFromInput(httpClient, new StepMsaDeviceCode.MsaDeviceCodeCallback(msaDeviceCode -> {
            System.out.println("Go to " + msaDeviceCode.getDirectVerificationUri());
        }));
        System.out.println("Chain: " + bedrockSession.getMcChain());

And I get the following error after entering the code:

Exception in thread "main" net.raphimc.minecraftauth.responsehandler.exception.MsaRequestException: status: 400 Bad Request, error: invalid_grant, error message: The user could not be authenticated or user interaction is required. The user must sign in again and if needed grant the client application access to the requested scope. at net.raphimc.minecraftauth.responsehandler.MsaResponseHandler.handleJsonError(MsaResponseHandler.java:31) at net.raphimc.minecraftauth.responsehandler.JsonHttpResponseHandler.handle(JsonHttpResponseHandler.java:45) at net.raphimc.minecraftauth.responsehandler.JsonHttpResponseHandler.handle(JsonHttpResponseHandler.java:30) at net.lenni0451.commons.httpclient.HttpClient.execute(HttpClient.java:213) at net.raphimc.minecraftauth.step.msa.StepMsaDeviceCodeMsaCode.applyStep(StepMsaDeviceCodeMsaCode.java:58) at net.raphimc.minecraftauth.step.msa.StepMsaDeviceCodeMsaCode.applyStep(StepMsaDeviceCodeMsaCode.java:34) at net.raphimc.minecraftauth.step.AbstractStep.getFromInput(AbstractStep.java:44) at net.raphimc.minecraftauth.step.AbstractStep.getFromInput(AbstractStep.java:44) at net.raphimc.minecraftauth.step.BiMergeStep.getFromInput(BiMergeStep.java:52) at net.raphimc.minecraftauth.step.BiMergeStep.getFromInput(BiMergeStep.java:22) at net.raphimc.minecraftauth.step.AbstractStep.getFromInput(AbstractStep.java:44) at net.raphimc.minecraftauth.step.AbstractStep.getFromInput(AbstractStep.java:44) at net.raphimc.minecraftauth.step.SameInputTriMergeStep.getFromInput(SameInputTriMergeStep.java:63) at net.raphimc.minecraftauth.step.SameInputTriMergeStep.getFromInput(SameInputTriMergeStep.java:26) at be.bloodyshine.cheat.Main.main(Main.java:22)

Same problem in other projects using this library. Maybe something has changed in the login process? I tried re-logging into my account, it didn't change the situation.

nikolayKeniston avatar May 10 '24 12:05 nikolayKeniston

Was reported to me for ProxyPass. On troubleshooting seemed to be related to https://github.com/PrismLauncher/PrismLauncher/issues/1223#issuecomment-1806756846, so essentially when signing into an MS account by email code.

Kas-tle avatar May 10 '24 14:05 Kas-tle

I could not reproduce this problem when signing into my MS account by email code.

@vasiliy-011 As a temporary workaround you can log into your account with the password instead of the email code. You might need to enable password authentication for your account. See the linked issues above for more details/steps.

RaphiMC avatar May 11 '24 09:05 RaphiMC

thank you very much, using the password solved the problem, after that there were no problems logging in using the msa code

nikolayKeniston avatar May 14 '24 07:05 nikolayKeniston

Small note: It turns out that passwordless authentication works if the application uses the JavaFX window method

RaphiMC avatar Jun 16 '24 20:06 RaphiMC

I just recently bought several accounts which I was using email codes for, and it was working initially but stopped working with this error after some time.

More thorough inspection considering which of my accounts failed and when, it appears that they worked for the first month after I registered them down to the day. When signing in, I also got a prompt about "setting up a backup email", though setting the backup email and not a password did not fix the issue.

Finally, I also tested setting a password and then signing in with an email code and that did work, so it's specifically the email code after a while when no password is set.

Edit: Also, setting up a password afterward doesn't make the old tokens from while it worked valid, they're still permanently invalidated and if they weren't already it invalidates them.

GreenScripter avatar Jun 22 '24 04:06 GreenScripter