firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.61k stars 1.06k forks source link

Issues handling merge conflicts when upgrading anonymous users with V9 compat #932

Open mkomaiha opened 2 years ago

mkomaiha commented 2 years ago

This is in regards to handling anonymous-upgrade-merge-conflict. Before updating to 6, I was on firebaseui 5.0 and firebase 8.x. Merge conflicts in the signInFailure would return the error.credentials

signInFailure: (error) => {
    // For merge conflicts, the error.code will be
    // 'firebaseui/anonymous-upgrade-merge-conflict'.
    if (
      error.code != "firebaseui/anonymous-upgrade-merge-conflict"
    ) {
      return Promise.resolve();
    }
    console.log(error.credential) // null
    // ... merge logic
}

I looked through some of the code and this seems to be an issue with firebaseui.js. The object no longer contains a credentials value as shown below image

Instead there is a customData key with the _tokenResponse that contains the IdToken image

volkerp commented 2 years ago

I'm facing the same problem. error.credential == null when using Google login/auth-provider, works as expected with email login/auth-provider. I also suspect the error is related to the compat libraries.

bhr commented 2 years ago

Hitting this issue too. Did you find any any workaround @volkerp ?

volkerp commented 2 years ago

Hitting this issue too. Did you find any any workaround @volkerp ?

Unfortunately no. My hunch is that the compat mode is not as compatible as it claims to be. At this time I'm wondering if the whole project is still active.