【问题标题】:second argument applicationverifier must be an implementation of firebase.auth.applicationverifier第二个参数 applicationverifier 必须是 firebase.auth.applicationverifier 的实现
【发布时间】:2019-09-21 21:29:06
【问题描述】:

第二个参数 applicationverifier 必须是 firebase.auth.applicationverifier 的实现

 .auth()
  .signInWithPhoneNumber(phoneNumber, appVerifier)
  .then(function(confirmationResult) {
    // SMS sent. Prompt user to type the code from the message, then sign the
    // user in with confirmationResult.confirm(code).
    window.confirmationResult = confirmationResult;
    //
    alert("SMS sent");
  })
  .catch(function(error) {
    // Error; SMS not sent
    // ...
    alert("Error ! SMS not sent");
  });



 initReCaptcha() {
setTimeout(() => {
  let vm = this;
  window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier(
    "recaptcha-container",
    {
      size: "invisible",
      callback: function(response) {
        // reCAPTCHA solved, allow signInWithPhoneNumber.
        // ...
      },
      "expired-callback": function() {
        // Response expired. Ask user to solve reCAPTCHA again.
        // ...
      }
    }
  );
  //
  this.appVerifier = window.recaptchaVerifier;
}, 1000);
}

created() {
  this.initReCaptcha();
}

我将应用程序验证器设置为第二个参数,但它会产生错误我该怎么办

【问题讨论】:

    标签: javascript firebase react-native firebase-authentication


    【解决方案1】:

    我看不出您在上述逻辑中延迟 appVerifier 初始化的原因。

    很可能appVerifier 在您调用时尚未初始化:

    signInWithPhoneNumber(phoneNumber, appVerifier)
    

    【讨论】:

      猜你喜欢
      • 2020-06-02
      • 1970-01-01
      • 2019-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-18
      • 2020-03-29
      • 1970-01-01
      相关资源
      最近更新 更多