diff --git a/FCLCore/src/main/java/com/tungsten/fclcore/auth/microsoft/MicrosoftAccount.java b/FCLCore/src/main/java/com/tungsten/fclcore/auth/microsoft/MicrosoftAccount.java index 183e0de7..a7e1915e 100644 --- a/FCLCore/src/main/java/com/tungsten/fclcore/auth/microsoft/MicrosoftAccount.java +++ b/FCLCore/src/main/java/com/tungsten/fclcore/auth/microsoft/MicrosoftAccount.java @@ -89,20 +89,16 @@ public class MicrosoftAccount extends OAuthAccount { @Override public AuthInfo logIn() throws AuthenticationException { - 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(); + 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"); } + + session = acquiredSession; + + authenticated = true; + invalidate(); } return session.toAuthInfo();