Error akan ditampilkan saat pengguna harus memberikan faktor kedua agar berhasil login.
Kode error untuk error ini adalah auth/multi-factor-auth-required
.
Tanda Tangan:
export interface MultiFactorError extends AuthError
Memperluas: AuthError
Properti
Properti | Jenis | Deskripsi |
---|---|---|
customData | AuthError['customData'] & { readonly operationsType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap]; } | Detail tentang MultiFactorError. |
MultiFactorError.customData
Detail tentang MultiFactorError.
Tanda Tangan:
readonly customData: AuthError['customData'] & {
readonly operationType: (typeof OperationTypeMap)[keyof typeof OperationTypeMap];
};
Contoh
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);