Skip to content

Commit

Permalink
Fix auto upgrade for oauth provider (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
renkelvin authored Jan 9, 2020
1 parent 6d6dfd6 commit b92607b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
12 changes: 4 additions & 8 deletions Auth/FirebaseAuthUI/FUIAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,11 @@ - (void)autoUpgradeAccountWithProviderUI:(id<FUIAuthProvider>)providerUI
if (error) {
// Check for "credential in use" conflict error and handle appropriately.
if (error.code == FIRAuthErrorCodeCredentialAlreadyInUse) {
FIRAuthCredential *newCredential = credential;
// Check for and handle special case for Phone Auth Provider.
if (providerUI.providerID == FIRPhoneAuthProviderID) {
// Obtain temporary Phone Auth credential.
newCredential = error.userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey];
FIRAuthCredential *newCredential = error.userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey];
NSDictionary *userInfo = @{ };
if (newCredential) {
userInfo = @{ FUIAuthCredentialKey : newCredential };
}
NSDictionary *userInfo = @{
FUIAuthCredentialKey : newCredential,
};
NSError *mergeError = [FUIAuthErrorUtils mergeConflictErrorWithUserInfo:userInfo
underlyingError:error];
[self completeSignInWithResult:authResult
Expand Down
2 changes: 1 addition & 1 deletion EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ - (void)signInWithDefaultValue:(nullable NSString *)defaultValue
}

- (void)signOut {

return;
}

- (BOOL)handleOpenURL:(NSURL *)URL sourceApplication:(nullable NSString *)sourceApplication {
Expand Down
11 changes: 1 addition & 10 deletions OAuth/FirebaseOAuthUI/FUIOAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,7 @@ - (void)signInWithDefaultValue:(nullable NSString *)defaultValue
}

- (void)signOut {
FIRUser *user = _authUI.auth.currentUser;
__weak UIViewController *weakController = self.presentingViewController;
[user deleteWithCompletion:^(NSError * _Nullable error) {
if (error) {
__strong UIViewController *presentingViewController = weakController;
[FUIAuthBaseViewController showAlertWithMessage:error.localizedDescription
presentingViewController:presentingViewController];
return;
}
}];
return;
}

- (BOOL)handleOpenURL:(NSURL *)URL sourceApplication:(nullable NSString *)sourceApplication {
Expand Down
1 change: 1 addition & 0 deletions PhoneAuth/FirebasePhoneAuthUI/FUIPhoneAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ - (void)signInWithDefaultValue:(nullable NSString *)defaultValue
}

- (void)signOut {
return;
}

- (BOOL)handleOpenURL:(NSURL *)URL sourceApplication:(nullable NSString *)sourceApplication {
Expand Down

0 comments on commit b92607b

Please sign in to comment.