MultiFactorError interface

Błąd wyświetlany, gdy użytkownik musi podać drugi składnik, aby można było się zalogować.

Kod błędu tego błędu to auth/multi-factor-auth-required.

Podpis:

export interface MultiFactorError extends AuthError 

Rozszerza: AuthError

Właściwości

Właściwość Typ Opis
customData AuthError['customData'] i { readonly sessionType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap]; Szczegóły błędu MultiFactorError.

Błąd wieloskładnikowy.customData

Szczegóły błędu MultiFactorError.

Podpis:

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

Przykład

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);