MultiFactorError interface

حدث الخطأ عندما يحتاج المستخدم إلى توفير عامل ثانٍ لتسجيل الدخول بنجاح.

رمز الخطأ لهذا الخطأ هو auth/multi-factor-auth-required .

إمضاء:

export interface MultiFactorError extends AuthError 

يمتد: AuthError

ملكيات

ملكية يكتب وصف
البيانات المخصصة خطأ في المصادقة ['customData'] & { نوع العملية للقراءة فقط: (نوع OperationTypeMap )[مفتاح نوع OperationTypeMap ]; } تفاصيل حول خطأ MultiFactorError.

MultiFactorError.customData

تفاصيل حول خطأ MultiFactorError.

إمضاء:

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

مثال

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