Firstly, using firebaseui-angular package to implement FirebaseUI.
I've set up anonymous guest accounts and I'm working on upgrading these accounts to real accounts. In my application, I do not want to merge accounts - if the user tries to upgrade an anonymous account to one that already exists I want to display an error message.
This is my code
login.component.html
<firebase-ui (signInSuccessWithAuthResult)="onSuccess($event)" (signInFailure)="onFailure($event)"></firebase-ui>
login.component.ts
onFailure(event) {
console.log(event);
if (event.code == 'firebaseui/anonymous-upgrade-merge-conflict') {
// what do I put here?
}
}
I can confirm that if they are an anonymous user and they try to upgrade with an account that already exists they get a signInFailure event with anonymous-upgrade-merge-conflict.
This is consistent with the documentation (https://firebase.google.com/docs/auth/web/firebaseui#handling_anonymous_user_upgrade_merge_conflicts)
My problem is I don't want to continue merging the account, I want to display an error message telling them they can't merge.
How do I display a custom error message on SignInFailure? Does the package support this? Do I need to display my own error message outside of FirebaseUI?