Jerlam
Jerlam

Reputation: 1081

Firebase google auth won't let me choose the account to connect with

I have implemented Firebase Auth into my app to let my users connect with their Google accounts. So far so good, however once a user has chosen to connect with a specific account from the google account chooser popup, he won't be able to choose a different account the next time he logs in. The previously selected account will be automatically picked for the authentication.

I really don't find this behavior correct, so I am trying to fix it. After some research I found that I can use setCustomParameters(prompt: "select_account") with the googleProvider, like so:

this.googleProvider = new firebase.auth.GoogleAuthProvider();
this.googleProvider.setCustomParameters({
   prompt: "select_account",
});

More info here: https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters

In my case, using the consent and select_account parameters don't seem to have any impact, the user does not get to choose which account to use.

Edit: It would seem that it works correctly with chrome, but not with firefox...

Upvotes: 7

Views: 2757

Answers (3)

Sohan Choudhary
Sohan Choudhary

Reputation: 11

Add this into your googleProvider and you'll see the popup:

const googleProvider = new GoogleAuthProvider();
googleProvider.setCustomParameters({ prompt: 'select_account' });

Upvotes: 1

zetian zhao
zetian zhao

Reputation: 11

Same issue. It's correct after adding

provider.setCustomParameters({
    prompt: "select_account"
})

Upvotes: 1

Jerlam
Jerlam

Reputation: 1081

I have found the source of the issue, it is in fact not really an issue. The google account picker will only show up if you have other accounts registered onto the device/browser you are currently using. If you want to choose a different account that is not saved into your device/browser, you would first need to log into it via google.

Upvotes: 1

Related Questions