[REQUIRED] Describe your environment
- Operating System version: MacOs Tahoe 26.3.1 (a) (25D771280a)
- Browser version: Chrome Version 147.0.7727.138 (Official Build) (x86_64)
- Firebase UI version: "@firebase-oss/ui-angular": "^7.0.2-beta"
- AngularFire Version: "@angular/fire": "~20.0.1",
- Firebase SDK version: "firebase": "~11.10.0"
- Package name: firebase-oss/ui-angular/auth
[REQUIRED] Describe the problem
I am using these two behaviours together autoAnonymousLogin, autoUpgradeAnonymousUsers.
The application behaviour I want is that users is initially signed anonymous credentials, and when they attempt to write to the database they are directed to firebase-ui to log-in using googleProvider and their credentials are upgraded to non-anonymous (i.e. the oauth credential is linked to the existing account).
If credential linking succeeds this works perfectly - the account is merged and the onUpgrade() handler is called.
If credential linking does not succeed, such as when the oAuth credential is already mapped to the anonymous credential:
- an error is presented in the UI
An account already exists with this email. Please sign in with that account.
- The
onUpgrade() handler is not called.
I can find no way to intercept this to execute my logic to merge the accounts. I believe the onUpgrade() handler should be called, but as best I can tell linkWithCredential() throws an exception which prevents the execution of the onUpgrade() handler.
|
const result = await linkWithCredential(currentUser, credential); |
Steps to reproduce
Create a firebase project with googleAuthentiaion provider enabled (any oAuth provider should work)
In angular project, with angularfire, using behaviours autoAnonymousLogin, autoUpgradeAnonymousUsers.
Create an anonymous user
Link that user to a google credential
Log out, and create a new anonymous users
Attempt to link that user to the same google credential
The linkWithCredential() call will fail (correct behavior), but onUpgrade() will not fire (I think this is unexpected).
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
I am using these two behaviours together autoAnonymousLogin, autoUpgradeAnonymousUsers.
The application behaviour I want is that users is initially signed anonymous credentials, and when they attempt to write to the database they are directed to firebase-ui to log-in using googleProvider and their credentials are upgraded to non-anonymous (i.e. the oauth credential is linked to the existing account).
If credential linking succeeds this works perfectly - the account is merged and the onUpgrade() handler is called.
If credential linking does not succeed, such as when the oAuth credential is already mapped to the anonymous credential:
An account already exists with this email. Please sign in with that account.onUpgrade()handler is not called.I can find no way to intercept this to execute my logic to merge the accounts. I believe the
onUpgrade()handler should be called, but as best I can telllinkWithCredential()throws an exception which prevents the execution of theonUpgrade()handler.firebaseui-web/packages/core/src/behaviors/anonymous-upgrade.ts
Line 36 in 3bbe28a
Steps to reproduce
Create a firebase project with googleAuthentiaion provider enabled (any oAuth provider should work)
In angular project, with angularfire, using behaviours autoAnonymousLogin, autoUpgradeAnonymousUsers.
Create an anonymous user
Link that user to a google credential
Log out, and create a new anonymous users
Attempt to link that user to the same google credential
The
linkWithCredential()call will fail (correct behavior), butonUpgrade()will not fire (I think this is unexpected).