Revert "auth: Always check token.exp when launch game (#2642)" (#2908)

This reverts commit 8678c0dcf2.
This commit is contained in:
Glavo
2024-03-09 20:25:59 +08:00
committed by GitHub
parent cb4cd696a0
commit eadfff349a

View File

@@ -84,16 +84,20 @@ public class MicrosoftAccount extends OAuthAccount {
@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();