MultiFactorError interface

השגיאה שנרשמה כאשר המשתמש צריך לספק גורם שני כדי להיכנס בהצלחה.

קוד השגיאה עבור שגיאה זו הוא auth/multi-factor-auth-required .

חֲתִימָה:

export interface MultiFactorError extends AuthError 

מרחיב: AuthError

נכסים

תכונה סוּג תיאור
נתונים מותאמים אישית AuthError ['customData'] ו-{ readonly operationType: (typeof 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);