3
votes

I'm trying to figure out if there's a way to send a verification email from Firebase Auth when an existing auth user is trying to UPDATE their email address. I want to do this before actually calling 'user.updateEmail(newEmail)' so that if they should not be using that email address for whatever reason, it doesn't actually change their email login in Firebase Auth.

It doesn't look like the 'sendEmailVerification' method allows for manually providing an email address to verify.

Ideally, I would like to do something like:

//User provides a newEmailAddress for their account

//Send verification email to the newEmailAddress

//User verifies newEmailAddress

user.updateEmail(newEmailAddress) is executed

Is there a graceful way to do this through Firebase Auth?

2

2 Answers

1
votes

There's nothing built into Firebase Authentication for this flow.

If you have your own email server, you can definitely implement it. But you will need to be comfortable generating your own nonces, sending email, and having an endpoint to handle the clicks in the email.

0
votes

There is actually a way. You need to set continueUrl and call verifyBeforeUpdateEmail, which will redirect the user to your app. The DynamicLink will contain the required information for you to validate the process and you can call updateEmail after that.