diff --git a/launcher/src/main/java/com/skcraft/launcher/auth/YggdrasilLoginService.java b/launcher/src/main/java/com/skcraft/launcher/auth/YggdrasilLoginService.java index 1e79934..0ea50c1 100644 --- a/launcher/src/main/java/com/skcraft/launcher/auth/YggdrasilLoginService.java +++ b/launcher/src/main/java/com/skcraft/launcher/auth/YggdrasilLoginService.java @@ -7,9 +7,6 @@ package com.skcraft.launcher.auth; import com.fasterxml.jackson.annotation.*; -import com.skcraft.launcher.auth.microsoft.MinecraftServicesAuthorizer; -import com.skcraft.launcher.auth.microsoft.model.McProfileResponse; -import com.skcraft.launcher.auth.skin.MinecraftSkinService; import com.skcraft.launcher.util.HttpRequest; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -63,13 +60,11 @@ public class YggdrasilLoginService implements LoginService { if (previous != null && previous.getAvatarImage() != null) { profile.setAvatarImage(previous.getAvatarImage()); - } else { - McProfileResponse skinProfile = MinecraftServicesAuthorizer - .getUserProfile("Bearer " + response.getAccessToken()); - - profile.setAvatarImage(MinecraftSkinService.fetchSkinHead(skinProfile)); } + // DEPRECEATION: minecraft services API no longer accepts yggdrasil tokens + // login still works though. until it doesn't, this class will remain + return profile; } } diff --git a/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/MinecraftServicesAuthorizer.java b/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/MinecraftServicesAuthorizer.java index 528fbbf..a64a67d 100644 --- a/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/MinecraftServicesAuthorizer.java +++ b/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/MinecraftServicesAuthorizer.java @@ -37,7 +37,13 @@ public class MinecraftServicesAuthorizer { .header("Authorization", authorization) .execute() .expectResponseCodeOr(200, req -> { - McServicesError error = req.returnContent().asJson(McServicesError.class); + HttpRequest.BufferedResponse content = req.returnContent(); + if (content.asBytes().length == 0) { + return new AuthenticationException("Got empty response from Minecraft services", + SharedLocale.tr("login.minecraft.error", req.getResponseCode())); + } + + McServicesError error = content.asJson(McServicesError.class); if (error.getError().equals("NOT_FOUND")) { return new AuthenticationException("No Minecraft profile", diff --git a/launcher/src/main/java/com/skcraft/launcher/dialog/AccountSelectDialog.java b/launcher/src/main/java/com/skcraft/launcher/dialog/AccountSelectDialog.java index 9221d79..6015f02 100644 --- a/launcher/src/main/java/com/skcraft/launcher/dialog/AccountSelectDialog.java +++ b/launcher/src/main/java/com/skcraft/launcher/dialog/AccountSelectDialog.java @@ -184,7 +184,8 @@ public class AccountSelectDialog extends JDialog { if (t instanceof AuthenticationException) { if (((AuthenticationException) t).isInvalidatedSession()) { // Just need to log in again - LoginDialog.ReloginDetails details = new LoginDialog.ReloginDetails(session.getUsername(), t.getLocalizedMessage()); + LoginDialog.ReloginDetails details = new LoginDialog.ReloginDetails(session.getUsername(), + SharedLocale.tr("login.relogin", t.getLocalizedMessage())); Session newSession = LoginDialog.showLoginRequest(AccountSelectDialog.this, launcher, details); setResult(newSession); diff --git a/launcher/src/main/resources/com/skcraft/launcher/lang/Launcher.properties b/launcher/src/main/resources/com/skcraft/launcher/lang/Launcher.properties index d8699d4..652c774 100644 --- a/launcher/src/main/resources/com/skcraft/launcher/lang/Launcher.properties +++ b/launcher/src/main/resources/com/skcraft/launcher/lang/Launcher.properties @@ -116,6 +116,7 @@ login.loggingInStatus=Logging in to Minecraft... login.noLoginError=Please enter your account details. login.noLoginTitle=Missing Account login.minecraftNotOwnedError=Sorry, Minecraft is not owned on that account. +login.relogin=Please log in again. ({0}) login.microsoft.seeBrowser=Check your browser to login with Microsoft. login.xbox.generic=Failed to authenticate with Xbox Live.