Skip to content

Commit

Permalink
Revert "auth: Always check token.exp when launch game (HMCL-dev#2642)" (
Browse files Browse the repository at this point in the history
HMCL-dev#2908)

This reverts commit 8678c0d.
  • Loading branch information
Glavo authored Mar 9, 2024
1 parent cb4cd69 commit eadfff3
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,20 @@ public String getIdentifier() {

@Override
public AuthInfo logIn() throws AuthenticationException {
if (!authenticated || !service.validate(session.getNotAfter(), session.getTokenType(), session.getAccessToken())) {
MicrosoftSession acquiredSession = service.refresh(session);
if (!Objects.equals(acquiredSession.getProfile().getId(), session.getProfile().getId())) {
throw new ServerResponseMalformedException("Selected profile changed");
if (!authenticated) {
if (service.validate(session.getNotAfter(), session.getTokenType(), session.getAccessToken())) {
authenticated = true;
} else {
MicrosoftSession acquiredSession = service.refresh(session);
if (!Objects.equals(acquiredSession.getProfile().getId(), session.getProfile().getId())) {
throw new ServerResponseMalformedException("Selected profile changed");
}

session = acquiredSession;

authenticated = true;
invalidate();
}

session = acquiredSession;

authenticated = true;
invalidate();
}

return session.toAuthInfo();
Expand Down

0 comments on commit eadfff3

Please sign in to comment.