Home > @firebase/auth > MultiFactorUser > unenroll
MultiFactorUser.unenroll() method
Unenrolls the specified second factor.
Signature:
unenroll(option: MultiFactorInfo | string): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
option | MultiFactorInfo | string | The multi-factor option to unenroll. |
Returns:
Promise<void>
- A promise which resolves when the unenroll operation is complete.
Description
To specify the factor to remove, pass a MultiFactorInfo object (retrieved from MultiFactorUser.enrolledFactors) or the factor's UID string. Sessions are not revoked when the account is unenrolled. An email notification is likely to be sent to the user notifying them of the change. Recent re-authentication is required for this operation to succeed. When an existing factor is unenrolled, an email notification is sent to the user’s email.
Example
const multiFactorUser = multiFactor(auth.currentUser);
// Present user the option to choose which factor to unenroll.
await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i])