Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Firebase/Auth/Source/Auth/FIRAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -1677,9 +1677,9 @@ - (void)scheduleAutoTokenRefreshWithDelay:(NSTimeInterval)delay retry:(BOOL)retr
@param callback Called when the user has been signed in or when an error occurred. Invoked
asynchronously on the global auth work queue in the future.
*/
- (void)completeSignInWithAccessToken:(NSString *)accessToken
accessTokenExpirationDate:(NSDate *)accessTokenExpirationDate
refreshToken:(NSString *)refreshToken
- (void)completeSignInWithAccessToken:(nullable NSString *)accessToken
accessTokenExpirationDate:(nullable NSDate *)accessTokenExpirationDate
refreshToken:(nullable NSString *)refreshToken
anonymous:(BOOL)anonymous
callback:(FIRAuthResultCallback)callback {
[FIRUser retrieveUserWithAuth:self
Expand Down Expand Up @@ -1800,7 +1800,7 @@ - (BOOL)updateCurrentUser:(nullable FIRUser *)user
@param outError Return value for any error which occurs.
@return @YES on success, @NO otherwise.
*/
- (BOOL)saveUser:(FIRUser *)user
- (BOOL)saveUser:(nullable FIRUser *)user
error:(NSError *_Nullable *_Nullable)outError {
BOOL success;

Expand Down Expand Up @@ -2014,8 +2014,8 @@ - (BOOL)useUserAccessGroup:(NSString *_Nullable)accessGroup
return YES;
}

- (FIRUser *)getStoredUserForAccessGroup:(NSString *_Nullable)accessGroup
error:(NSError *_Nullable *_Nullable)outError {
- (nullable FIRUser *)getStoredUserForAccessGroup:(NSString *_Nullable)accessGroup
error:(NSError *_Nullable *_Nullable)outError {
FIRUser *user;
if (!accessGroup) {
NSString *userKey = [NSString stringWithFormat:kUserKey, _firebaseAppName];
Expand Down
44 changes: 24 additions & 20 deletions Firebase/Auth/Source/AuthProvider/Phone/FIRPhoneAuthProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ - (void)verifyClientAndSendVerificationCodeToPhoneNumber:(NSString *)phoneNumber
callback(nil, error);
return;
}
FIRSendVerificationCodeRequest *request;
FIRSendVerificationCodeRequest * _Nullable request;
if (appCredential) {
request =
[[FIRSendVerificationCodeRequest alloc]
Expand All @@ -287,28 +287,30 @@ - (void)verifyClientAndSendVerificationCodeToPhoneNumber:(NSString *)phoneNumber
reCAPTCHAToken:reCAPTCHAToken
requestConfiguration:self->_auth.requestConfiguration];
}
[FIRAuthBackend sendVerificationCode:request
callback:^(FIRSendVerificationCodeResponse *_Nullable response,
NSError *_Nullable error) {
if (error) {
if (error.code == FIRAuthErrorCodeInvalidAppCredential) {
if (retryOnInvalidAppCredential) {
[self->_auth.appCredentialManager clearCredential];
[self verifyClientAndSendVerificationCodeToPhoneNumber:phoneNumber
retryOnInvalidAppCredential:NO
UIDelegate:UIDelegate
callback:callback];
if (request) {
[FIRAuthBackend sendVerificationCode:request
callback:^(FIRSendVerificationCodeResponse *_Nullable response,
NSError *_Nullable error) {
if (error) {
if (error.code == FIRAuthErrorCodeInvalidAppCredential) {
if (retryOnInvalidAppCredential) {
[self->_auth.appCredentialManager clearCredential];
[self verifyClientAndSendVerificationCodeToPhoneNumber:phoneNumber
retryOnInvalidAppCredential:NO
UIDelegate:UIDelegate
callback:callback];
return;
}
callback(nil, [FIRAuthErrorUtils unexpectedResponseWithDeserializedResponse:nil
underlyingError:error]);
return;
}
callback(nil, [FIRAuthErrorUtils unexpectedResponseWithDeserializedResponse:nil
underlyingError:error]);
callback(nil, error);
return;
}
callback(nil, error);
return;
}
callback(response.verificationID, nil);
}];
callback(response.verificationID, nil);
}];
}
}];
}

Expand Down Expand Up @@ -436,7 +438,9 @@ - (void)reCAPTCHAURLWithEventID:(NSString *)eventID completion:(FIRReCAPTCHAURLC
NSURLComponents *components = [[NSURLComponents alloc] initWithString:
[NSString stringWithFormat:kReCAPTCHAURLStringFormat, authDomain]];
[components setQueryItems:queryItems];
completion([components URL], nil);
if (completion) {
completion([components URL], nil);
}
}];
}

Expand Down
4 changes: 2 additions & 2 deletions Firebase/Auth/Source/Public/FIRAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,8 @@ DEPRECATED_MSG_ATTRIBUTE("Please use signInWithCredential:completion: for Object
/** @fn getStoredUserForAccessGroup:error:
@brief Get the stored user in the given accessGroup.
*/
- (FIRUser *)getStoredUserForAccessGroup:(NSString *_Nullable)accessGroup
error:(NSError *_Nullable *_Nullable)outError;
- (nullable FIRUser *)getStoredUserForAccessGroup:(NSString *_Nullable)accessGroup
error:(NSError *_Nullable *_Nullable)outError;

@end

Expand Down
3 changes: 2 additions & 1 deletion Firebase/Auth/Source/Storage/FIRAuthKeychain.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ NS_ASSUME_NONNULL_BEGIN
@param outError The address to store any error that occurs during the process, if not nil.
@return The item of the given query. nil if not exsit.
*/
- (NSData *)getItemWithQuery:(NSDictionary *)query error:(NSError *_Nullable *_Nullable)outError;
- (nullable NSData *)getItemWithQuery:(NSDictionary *)query
error:(NSError *_Nullable *_Nullable)outError;

/** @fn setItem:withQuery:error:
@brief Set the item into keychain with given query.
Expand Down
5 changes: 3 additions & 2 deletions Firebase/Auth/Source/Storage/FIRAuthKeychain.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ - (BOOL)removeDataForKey:(NSString *)key error:(NSError **_Nullable)error {

#pragma mark - Private methods for non-sharing keychain operations

- (NSData *)itemWithQuery:(NSDictionary *)query error:(NSError **_Nullable)error {
- (nullable NSData *)itemWithQuery:(NSDictionary *)query error:(NSError **_Nullable)error {
NSMutableDictionary *returningQuery = [query mutableCopy];
returningQuery[(__bridge id)kSecReturnData] = @YES;
returningQuery[(__bridge id)kSecReturnAttributes] = @YES;
Expand Down Expand Up @@ -233,7 +233,8 @@ - (NSDictionary *)legacyGenericPasswordQueryWithKey:(NSString *)key {

#pragma mark - Private methods for shared keychain operations

- (NSData *)getItemWithQuery:(NSDictionary *)query error:(NSError *_Nullable *_Nullable)outError {
- (nullable NSData *)getItemWithQuery:(NSDictionary *)query
error:(NSError *_Nullable *_Nullable)outError {
NSMutableDictionary *mutableQuery = [query mutableCopy];

mutableQuery[(__bridge id)kSecReturnData] = @YES;
Expand Down
5 changes: 4 additions & 1 deletion Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,10 @@ + (NSError *)errorWithCode:(FIRAuthInternalErrorCode)code
if (isPublic) {
// This is a public error. Return it as a public error and add a description.
NSInteger errorCode = code & ~FIRAuthPublicErrorCodeFlag;
NSMutableDictionary *errorUserInfo = [NSMutableDictionary dictionaryWithDictionary:userInfo];
NSMutableDictionary *errorUserInfo = [NSMutableDictionary dictionary];
if (userInfo) {
[errorUserInfo addEntriesFromDictionary:userInfo];
}
if (!errorUserInfo[NSLocalizedDescriptionKey]) {
errorUserInfo[NSLocalizedDescriptionKey] = FIRAuthErrorDescription(errorCode);
}
Expand Down