Disable AccountChooser for Firebase Auth
Asked Answered
J

4

19

I'm trying the new FirebaseUI for Web (https://github.com/firebase/FirebaseUI-Web). But when I tried to login with Email, it redirects me to an AccountChooser website.

Is there anyway that I can turn off that AccountChooser?

Thanks

Julius answered 22/5, 2016 at 2:26 Comment(0)
G
27

You can disable by adding an entry into the variable uiConfig in Firebase. You have to add this in the uiConfig variable:

'credentialHelper': firebaseui.auth.CredentialHelper.NONE

Here is an example of it inside uiConfig:

var uiConfig = {
    callbacks: {
        signInSuccess: function (currentUser, credential, redirectUrl) {
            return true;
        },
        uiShown: function () {
            document.getElementById('loader').style.display = 'none';
        }
    },
    //Start it here 
    credentialHelper: firebaseui.auth.CredentialHelper.NONE,
    //End it here 
    signInFlow: 'popup',
    signInSuccessUrl: '<url-to-redirect-to-on-success>',
    signInOptions: [
        // Leave the lines as is for the providers you want to offer your users.
        firebase.auth.GoogleAuthProvider.PROVIDER_ID,
        firebase.auth.FacebookAuthProvider.PROVIDER_ID,
        firebase.auth.TwitterAuthProvider.PROVIDER_ID,
        firebase.auth.EmailAuthProvider.PROVIDER_ID
    ],
    // Terms of service url.
    tosUrl: '<your-tos-url>'
};

var ui = new firebaseui.auth.AuthUI(firebase.auth());
ui.start('#firebaseui-auth-container', uiConfig);
Gabby answered 22/2, 2017 at 19:10 Comment(0)
P
3

If anyone isn't bringing in firebaseui (e.g. if you're using react-firebaseui), it could be helpful know thatfirebaseui.auth.CredentialHelper.NONE === 'none'

This answer was provided in this SO question: Disable account chooser FirebaseUI React Credit to @RafikTighilt and @JeffBergman

Pubes answered 11/12, 2018 at 7:33 Comment(0)
C
1

I am using /__/firebase/init.js and no explicit initialization and getting

firebaseui not initialized on ,'credentialHelper': firebaseui.auth.CredentialHelper.NONE

Solution, change the order of the statements:

  1. var ui = new ...
  2. var uiConfig = { ...
  3. ui.start('#firebaseui-auth-container', uiConfig);
Caraway answered 23/9, 2019 at 10:46 Comment(0)
T
-1

Found a fix for this here:

https://github.com/firebase/firebaseui-web/issues/42

Download the firebase-ui-auth.js file (you can copy version 0.5 from here). You need to change one character and host the file yourself instead of using the CDN.

In the file, look for: "accountChooserEnabled",!0 and change the !0 to !1.

This did the trick for me!

Telmatelo answered 16/10, 2016 at 23:46 Comment(1)
This is outdated now.Gabby

© 2022 - 2024 — McMap. All rights reserved.