1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-23 12:05:44 +01:00

Remove broken skin fetching for Yggdrasil auth

"mandatory migration" my ass
This commit is contained in:
Henry Le Grys 2022-04-18 22:37:48 +01:00
parent 53ba054c2c
commit bad4363bed
4 changed files with 13 additions and 10 deletions

View File

@ -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;
}
}

View File

@ -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",

View File

@ -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);

View File

@ -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.