ユーザーが正常にサインインするために 2 番目の要素を指定する必要がある場合にスローされるエラー。
このエラーのエラー コードはauth/multi-factor-auth-required
です。 。
サイン:
export interface MultiFactorError extends AuthError
拡張: AuthError
プロパティ
財産 | タイプ | 説明 |
---|---|---|
カスタムデータ | 認証エラー['customData'] & { 読み取り専用 OperationType: ( 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);