I am trying to convert a firebase user from Anonymous to permanent using email/password and running into errors.
The documentation and other articles state that I should linkWithProvider but it throws an exception that the email should be verified first, however, doing so throws another exception asking me to login first.
Here are snippets of what I tried so far
final emailAuthCredential = EmailAuthProvider.credential(
email: email,
password: password,
);
await currentUser.linkWithProvider(emailAuthCredential);
FirebaseAuthException ([firebase_auth/operation-not-allowed] Please verify the new email before changing email.)
final emailAuthCredential = EmailAuthProvider.credential(
email: email,
password: password,
);
await currentUser.verifyBeforeUpdateEmail(email);
FirebaseAuthException ([firebase_auth/requires-recent-login] This operation is sensitive and requires recent authentication. Log in again before retrying this request.)
2
Answers
The solution was in the documentation (duh...). You now have to use the identity platform API and call signup with the anonymous token.
You can use this code
}