Firebase Google Authentication - Account Picker

4,406 views
Skip to first unread message

thetomat...@gmail.com

unread,
Mar 5, 2017, 8:38:45 PM3/5/17
to Firebase Google Group
Hi,

Maybe I don't fully grasp the way the Google Authentication API works via firebase.

The problem:

When the user is signed into any other Google service like Gmail in a browser, on clicking "Sign-in to Google" on a Firebase Auth Workflow the following happens:

1) If there is only one account the user is signed into via a Google Service no "Account Picker" shows up giving the user the option to sign in using a different Google ID. It presumes the user wants to sign into the Firebase project page with that already signed in Google account

2) If the user has signed into multiple accounts for any Google Service in the browser the "Account Picker" shows up letting the user choose the account they want to Sign into the Firebase Project with

It would be great if the user always gets the "Account Picker" irrespective of if they are signed in with one account on another Google Service in the same Browser or more


Or maybe I am misunderstanding the flow and this is exactly how the flow is supposed to go!
Or maybe I'm doing something wrong? wrt the implementation of the Authentication.

Appreciate your thoughts.

Regards,
Mark

Jacob Wenger

unread,
Mar 5, 2017, 8:48:26 PM3/5/17
to fireba...@googlegroups.com
Hey there,

The Firebase SDK simply falls back to the default behavior Google has chosen to determine if the account picker should be shown. I believe you can actually override this default behavior by using the setCustomParameters() method and providing a value for the prompt parameter (full list of available parameters is here). Here is some rough code to always show the account picker, which I didn't test but should work:

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

Cheers,
Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/f0f46de2-f92d-4b26-8f78-0a8d891dbda5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

thetomat...@gmail.com

unread,
Mar 6, 2017, 9:58:43 AM3/6/17
to Firebase Google Group
Hi Jacob,

Thank you so much. 

The code you shared worked fine.

Easy peasy :)

Regards,
Mark
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages