Fix[auth]: don't crash if fails to load token from keychain
This commit is contained in:
1 parent
0a13331cdc
commit
c5042e2ce9
1 file changed
+5
-1
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user