Litarvan / OpenAuth

Java Yggdrasil library.
GNU General Public License v3.0
161 stars 30 forks source link

[BUG] Server returned HTTP response code: 429 for URL: https://api.minecraftservices.com/authentication/login_with_xbox #33

Closed Tr0llagent closed 1 year ago

Tr0llagent commented 1 year ago

when i am executing the code iI have this error

Caused by: java.io.IOException: Server returned HTTP response code: 429 for URL: https://api.minecraftservices.com/authentication/login_with_xbox
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1952)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1947)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1946)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1516)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1500)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
    at fr.litarvan.openauth.microsoft.HttpClient.readResponse(HttpClient.java:114)
    ... 6 more

My code

MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator();
MicrosoftAuthResult result = null;
try {
    result = authenticator.loginWithCredentials(email,password);
    System.out.printf("Logged in with '%s'%n", result.getProfile().getName());
    Minecraft.getMinecraft().session = new Session(result.getProfile().getName(),result.getProfile().getId(), result.getAccessToken(),"legacy");
} catch (MicrosoftAuthenticationException e) {
    this.status = "&4Login failed.";
}