MultiFactorError interface

The error thrown when the user needs to provide a second factor to sign in successfully.

The error code for this error isauth/multi-factor-auth-required.

Signature:

exportinterfaceMultiFactorErrorextendsAuthError

Extends:AuthError

Properties

PropertyTypeDescription
customDataAuthError['customData'] & { readonly operationType: (typeofOperationTypeMap)[keyof typeofOperationTypeMap]; }Details about the MultiFactorError.

MultiFactorError.customData

Details about the MultiFactorError.

Signature:

readonlycustomData:AuthError['customData'] &{readonlyoperationType:(typeofOperationTypeMap)[keyoftypeofOperationTypeMap];};

Example

letresolver;letmultiFactorHints;signInWithEmailAndPassword(auth,email,password).then((result)=>{// User signed in. No 2nd factor challenge is needed.}).catch((error)=>{if(error.code=='auth/multi-factor-auth-required'){resolver=getMultiFactorResolver(auth,error);multiFactorHints=resolver.hints;}else{// Handle other errors.}});// Obtain a multiFactorAssertion by verifying the second factor.constuserCredential=awaitresolver.resolveSignIn(multiFactorAssertion);

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-04-27 UTC.