The Firebase authListener shows the account chooser but doesn't recognise any user the first time I try to login.
Then, trying to login again for a second time, FirebaseUI skips the account chooser and immediately redirects back, after which the Firebase authListener does recognise the user. The same is true for the Google account chooser as for "Sign in with email" and choosing the same Google address.
This problem makes all my users need to press the login button twice. Once for the account chooser and a second time to actually login with the user now recognised.
Here is my build:
firebase.initializeApp(config.firebase)
firebase.auth().onAuthStateChanged(user => {
if (user) {
return console.log('found this user! ', user)
}
console.log('no user found during authListener!')
})
firebase.auth().getRedirectResult()
.then(result => { console.log(result.user) })
.catch(error => { console.log(error) })
let ui = firebaseui.auth.AuthUI.getInstance()
if (!ui) {
ui = new firebaseui.auth.AuthUI(firebase.auth())
}
ui.start('#firebaseui-auth-container', uiConfig)
uiConfig = {
signInSuccessUrl: '/',
signInOptions: [
{
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
requireDisplayName: false
},
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
],
tosUrl: 'localhost'
}
Versions:
"firebase": "^5.0.4",
"firebaseui": "^3.0.0",
PS:
My website is an SPA
I "solved" this problem by adding the following to the config object:
credentialHelper: firebaseui.auth.CredentialHelper.NONE
This turns off the account chooser entirely, instead prompting users to type in their email address, resulting in a much nicer user experience IMHO compared to the ugly and confusing account chooser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With