From 214223bf57f61a633981bb786ed7ca9c1fb59627 Mon Sep 17 00:00:00 2001 From: lcxn123 Date: Tue, 23 Jun 2026 10:31:20 +0800 Subject: [PATCH 1/2] fix --- .../jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java index d178b6951f0..b297df97bc1 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java @@ -103,10 +103,7 @@ public UUID getProfileID() { @Override public synchronized AuthInfo logIn() throws AuthenticationException { - if (!authenticated || !session.hasProfileName()) { - if (session.hasProfileName() && service.validate(session.getAccessToken(), session.getClientToken())) { - authenticated = true; - } else { + if (!authenticated || !session.hasProfileName() || !service.validate(session.getAccessToken(), session.getClientToken())) { YggdrasilSession acquiredSession; try { acquiredSession = service.refresh(session.getAccessToken(), session.getClientToken(), null); @@ -130,8 +127,6 @@ public synchronized AuthInfo logIn() throws AuthenticationException { authenticated = true; invalidate(); } - } - return session.toAuthInfo(); } From 03d352d755330fd7fd5661945b12848aae6ae4c9 Mon Sep 17 00:00:00 2001 From: lcxn123 Date: Tue, 23 Jun 2026 11:11:40 +0800 Subject: [PATCH 2/2] Fix yggdrasil account refresh indentation --- .../hmcl/auth/yggdrasil/YggdrasilAccount.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java index b297df97bc1..a789f7112b5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java @@ -104,29 +104,29 @@ public UUID getProfileID() { @Override public synchronized AuthInfo logIn() throws AuthenticationException { if (!authenticated || !session.hasProfileName() || !service.validate(session.getAccessToken(), session.getClientToken())) { - YggdrasilSession acquiredSession; - try { - acquiredSession = service.refresh(session.getAccessToken(), session.getClientToken(), null); - } catch (RemoteAuthenticationException e) { - if ("ForbiddenOperationException".equals(e.getRemoteName())) { - throw new CredentialExpiredException(e); - } else { - throw e; - } - } - if (acquiredSession.getSelectedProfile() == null || - !acquiredSession.getSelectedProfile().getId().equals(profileID)) { - throw new ServerResponseMalformedException("Selected profile changed"); - } - if (!acquiredSession.hasProfileName()) { - throw new ServerResponseMalformedException("Profile name is missing"); + YggdrasilSession acquiredSession; + try { + acquiredSession = service.refresh(session.getAccessToken(), session.getClientToken(), null); + } catch (RemoteAuthenticationException e) { + if ("ForbiddenOperationException".equals(e.getRemoteName())) { + throw new CredentialExpiredException(e); + } else { + throw e; } + } + if (acquiredSession.getSelectedProfile() == null || + !acquiredSession.getSelectedProfile().getId().equals(profileID)) { + throw new ServerResponseMalformedException("Selected profile changed"); + } + if (!acquiredSession.hasProfileName()) { + throw new ServerResponseMalformedException("Profile name is missing"); + } - session = acquiredSession; + session = acquiredSession; - authenticated = true; - invalidate(); - } + authenticated = true; + invalidate(); + } return session.toAuthInfo(); }