MultiFactorError interface

使用者必須提供第二重驗證才能成功登入時擲回的錯誤。

這個錯誤的錯誤代碼為 auth/multi-factor-auth-required

簽名:

export interface MultiFactorError extends AuthError 

擴充: AuthError

屬性

屬性 類型 說明
customData AuthError['customData'] 和{ readonly actionType: (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);