Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for _userAccessGroup being nil when getStoredUserForAccessGroup is called #7472

Merged
merged 11 commits into from
Mar 2, 2021
11 changes: 6 additions & 5 deletions FirebaseAuth/Sources/Auth/FIRAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,12 @@ - (BOOL)internalUseUserAccessGroup:(NSString *_Nullable)accessGroup
return NO;
}

if (_userAccessGroup == nil && accessGroup != nil) {
NSString *userKey = [NSString stringWithFormat:kUserKey, _firebaseAppName];
[_keychainServices removeDataForKey:userKey error:outError];
}
_userAccessGroup = accessGroup;

FIRUser *user = [self getStoredUserForAccessGroup:accessGroup error:outError];
if (!user && outError && *outError) {
return NO;
Expand All @@ -2214,11 +2220,6 @@ - (BOOL)internalUseUserAccessGroup:(NSString *_Nullable)accessGroup
return NO;
}

if (_userAccessGroup == nil && accessGroup != nil) {
NSString *userKey = [NSString stringWithFormat:kUserKey, _firebaseAppName];
[_keychainServices removeDataForKey:userKey error:outError];
}
_userAccessGroup = accessGroup;
self->_lastNotifiedUserToken = user.rawAccessToken;

return YES;
Expand Down