El error que se muestra cuando el usuario necesita proporcionar un segundo factor para acceder correctamente.
El código de error de este error es auth/multi-factor-auth-required
.
Firma:
export interface MultiFactorError extends AuthError
Extiende: AuthError
Propiedades
Propiedad | Tipo | Descripción |
---|---|---|
customData | AuthError['customData'] y { readonly operationsType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap]; }. | Detalles sobre MultiFactorError. |
MultiFactorError.customData
Detalles sobre MultiFactorError.
Firma:
readonly customData: AuthError['customData'] & {
readonly operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap];
};
Ejemplo
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);