Ad

Send Verification Email When Updating Email Address In Firebase Auth

- 1 answer

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?

Ad

Answer

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.

Ad
source: stackoverflow.com
Ad