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

3

7

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...

Cp answered 27/5, 2020 at 12:29 Comment(0)
C
1

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.

Cp answered 27/5, 2020 at 12:52 Comment(2)
So the first time I logged in it allowed me to type. my email address and sign into my account. I then sign out, how do I pick to sign into another account? Right now its just signing me back into the first account.Guggenheim
@TenDigitGrid https://mcmap.net/q/1626679/-android-firebaseui-signing-in-with-another-google-account-is-troublesomeHomochromous
S
1

Same issue. It's correct after adding

provider.setCustomParameters({
    prompt: "select_account"
})
Shebat answered 22/10, 2023 at 14:46 Comment(1)
It would be better to add a clarification about how this works.Biafra
U
1

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

const googleProvider = new GoogleAuthProvider();
googleProvider.setCustomParameters({ prompt: 'select_account' });
Udella answered 23/11, 2023 at 5:36 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Tine
This worked perfectly! Thank you! Using "firebase": "10.8.1" (javascript) Tested in Chrome Version 123.0.6312.87Gstring

© 2022 - 2024 — McMap. All rights reserved.