Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 第二个参数applicationverifier必须是firebase.auth.applicationverifier的实现_Javascript_Firebase_React Native_Firebase Authentication - Fatal编程技术网

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

Javascript 第二个参数applicationverifier必须是firebase.auth.applicationverifier的实现,javascript,firebase,react-native,firebase-authentication,Javascript,Firebase,React Native,Firebase Authentication,第二个参数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 // us

第二个参数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();
}

我将app-verifier设置为第二个参数,但它会生成错误我该怎么办?在上面的逻辑中,我看不出您延迟初始化
appVerifier
的原因

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

signInWithPhoneNumber(phoneNumber, appVerifier)