Change user using Firebase

When using Google Firebase user authentication, the user immediately logs in if he has already allowed the application and only logged into one Google account.

Is there a way to make the Select Account dialog box appear so that a user can log in to another Google account or create a new one?

Currency, as far as I know, the user must manually log out of the current Google account (or log in> 1) from Google.com to open a dialog box.

+6
source share
4 answers

You can force an account with the provider prompt parameter.

var googleAuthProvider = new firebase.auth.GoogleAuthProvider(); googleAuthProvider.setCustomParameters({ prompt: 'select_account' }); firebase.auth().signInWithRedirect(googleAuthProvider) 

Tested with Firebase JavaScript SDK v4.1.2

+5
source

I am trying to understand the same thing. According to some Google docs, it seems that you can force an account to be set up using the prompt command (no, select_account or consent):

Set up google google account

... however, there is no way to set the prompt to any of the Firebase authentication methods (specifically authWithOAuthRedirect and authWithOAuthPopup ).

Have you ever understood this?

+1
source

You must explicitly exit Google:

 Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(status -> { mFirebaseAuth.signOut(); }); 

Found solution here

+1
source

Use this method to exit.

  Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback<Status>() { @Override public void onResult(@NonNull Status status) { mAuth.signOut(); } }); 
0
source

All Articles