MultiFactorError interface

زمانی که کاربر نیاز به ارائه فاکتور دوم برای ورود موفقیت آمیز به سیستم دارد، خطا رخ می دهد.

کد خطای این خطا auth/multi-factor-auth-required است .

امضا:

export interface MultiFactorError extends AuthError 

گسترش می یابد: AuthError

خواص

ویژگی تایپ کنید شرح
داده های سفارشی AuthError ['customData'] & { فقط خواندنی operationType: (نوع OperationTypeMap )[keyof typeof 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);