MultiFactorError interface

当用户需要提供第二个因素才能成功登录时引发的错误。

此错误的错误代码是auth/multi-factor-auth-required

签名:

export interface MultiFactorError extends AuthError 

扩展: AuthError

特性

财产类型描述
自定义数据验证错误['customData'] & { 只读操作类型: (操作类型映射类型)[ OperationTypeMap类型的键]; }有关 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);