The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/auth > verifyBeforeUpdateEmail

verifyBeforeUpdateEmail() function

Sends a verification email to a new email address.

Signature:

export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;

Parameters

Parameter Type Description
user User The user.
newEmail string The new email address to be verified before update.
actionCodeSettings ActionCodeSettings | null The ActionCodeSettings.

Returns:

Promise<void>

Description

The user's email will be updated to the new one after being verified.

If you have a custom email action handler, you can complete the verification process by calling applyActionCode().

Example

const actionCodeSettings = {
  url: 'https://www.example.com/?email=user@example.com',
  iOS: {
     bundleId: 'com.example.ios'
  },
  android: {
    packageName: 'com.example.android',
    installApp: true,
    minimumVersion: '12'
  },
  handleCodeInApp: true
};
await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
// Obtain code from the user.
await applyActionCode(auth, code);