MultiFactorError interface

O erro gerado quando o usuário precisa informar um segundo fator para fazer login.

O código desse erro é auth/multi-factor-auth-required.

Assinatura:

export interface MultiFactorError extends AuthError 

Estende: AuthError

Propriedades

Propriedade Tipo Descrição
customData AuthError['customData'] & { readonly operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap]; } Detalhes sobre o MultiFactorError.

MultiFactorError.customData

Detalhes sobre o MultiFactorError.

Assinatura:

readonly customData: AuthError['customData'] & {
       
readonly operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap];
   
};

Exemplo

let resolver;
let multiFactorHints
;

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.

const userCredential = await resolver.resolveSignIn(multiFactorAssertion);