Skip to content

Commit

Permalink
fix(ui_auth): fix linking OAuthProvider from ProfileScreen (#11168)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky committed Jul 13, 2023
1 parent ad50074 commit 5063af5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/firebase_ui_oauth/lib/src/platform_oauth_sign_in_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ mixin PlatformSignInMixin {
OAuthListener get authListener;
dynamic get firebaseAuthProvider;

void _webOnLinked(UserCredential userCredential) {
return authListener.onCredentialLinked(userCredential.credential!);
}

/// {@macro ui.oauth.platform_sign_in_mixin.platform_sign_in}
void platformSignIn(TargetPlatform platform, AuthAction action) {
Future<UserCredential> credentialFuture;

if (action == AuthAction.link) {
credentialFuture = auth.currentUser!.linkWithPopup(firebaseAuthProvider);
auth.currentUser!
.linkWithPopup(firebaseAuthProvider)
.then(_webOnLinked)
.catchError(authListener.onError);
} else {
credentialFuture = auth.signInWithPopup(firebaseAuthProvider);
auth
.signInWithPopup(firebaseAuthProvider)
.then(authListener.onSignedIn)
.catchError(authListener.onError);
}

credentialFuture
.then(authListener.onSignedIn)
.catchError(authListener.onError);
}
}

0 comments on commit 5063af5

Please sign in to comment.