diff --git a/Natives/authenticator/MicrosoftAuthenticator.m b/Natives/authenticator/MicrosoftAuthenticator.m index 5ab25a74..ba15c96c 100644 --- a/Natives/authenticator/MicrosoftAuthenticator.m +++ b/Natives/authenticator/MicrosoftAuthenticator.m @@ -217,9 +217,13 @@ typedef void(^XSTSCallback)(NSString *xsts, NSString *uhs); - (void)refreshTokenWithCallback:(Callback)callback { // Move tokens to keychain if we haven't if (!self.tokenData) { - [self saveChanges]; + showDialog(localize(@"Error", nil), @"Failed to load account tokens from keychain"); + callback(nil, YES); + return; } + [self saveChanges]; + if ([NSDate.date timeIntervalSince1970] > [self.authData[@"expiresAt"] longValue]) { [self acquireAccessToken:self.tokenData[@"refreshToken"] refresh:YES callback:callback]; } else {