Skip to content

Commit 7883877

Browse files
committed
add SignOut if user canceled account linking (clean provider token)
1 parent 9d17f34 commit 7883877

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

FirebaseAuthUI/FIRAuthUIBaseViewController.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ - (void)showSignInAlertWithEmail:(NSString *)email
230230
UIAlertAction *cancelAction =
231231
[UIAlertAction actionWithTitle:[FIRAuthUIStrings cancel]
232232
style:UIAlertActionStyleCancel
233-
handler:nil];
233+
handler:^(UIAlertAction * _Nonnull action) {
234+
[self.authUI signOutWithError:nil];
235+
}];
234236
[alertController addAction:cancelAction];
235237
[self presentViewController:alertController animated:YES completion:nil];
236238
} else {
@@ -241,7 +243,9 @@ - (void)showSignInAlertWithEmail:(NSString *)email
241243
cancelButtonTitle:[FIRAuthUIStrings cancel]
242244
otherButtonTitles:provider.signInLabel, nil];
243245
FIRAuthUIAlertViewDelegate *delegate =
244-
[[FIRAuthUIAlertViewDelegate alloc] initWithCancelHandler:nil otherHandlers:@[ handler ]];
246+
[[FIRAuthUIAlertViewDelegate alloc] initWithCancelHandler:^{
247+
[self.authUI signOutWithError:nil];
248+
} otherHandlers:@[ handler ]];
245249
alertView.delegate = delegate;
246250
[alertView show];
247251
}

0 commit comments

Comments
 (0)