ข้อผิดพลาดเกิดขึ้นเมื่อผู้ใช้ต้องระบุปัจจัยที่ 2 เพื่อลงชื่อเข้าใช้ให้สำเร็จ
รหัสข้อผิดพลาดสำหรับข้อผิดพลาดนี้คือ 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);