MultiFactorError interface

Błąd zgłaszany, gdy użytkownik musi podać drugi czynnik, aby pomyślnie się zalogować.

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

Podpis:

export interface MultiFactorError extends AuthError 

Rozszerza się: AuthError

Nieruchomości

Nieruchomość Typ Opis
niestandardoweDane Błąd autoryzacji ['customData'] & { typ operacji tylko do odczytu: (typ OperationTypeMap )[klucz typu OperationTypeMap ]; } Szczegóły dotyczące błędu MultiFactorError.

MultiFactorError.customData

Szczegóły dotyczące 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);