firebase.auth.RecaptchaVerifier不是构造函数错误 [英] firebase.auth.RecaptchaVerifier is not a constructor error

查看:69
本文介绍了firebase.auth.RecaptchaVerifier不是构造函数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用firebase.initializeApp(config);初始化Firebase应用后,尝试在我的html中添加Firebase脚本.

Trying to add the Firebase script in my html, after initializing Firebase app with firebase.initializeApp(config);.

所以我有这个:

 <script>

          window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', 
           {
            'size': 'invisible',
            'callback': function(response) {
            // reCAPTCHA solved, allow signInWithPhoneNumber.
            onSignInSubmit();
            }
      });

 </script>

哪个提供错误:

firebase.auth.RecaptchaVerifier is not a constructor error

  1. 如何解决此错误(发现相似的问题却没有直接答案)
  2. 如何从这里继续进行?

编辑:

我在html的开头有这个内容:

I have this in the beginning of the html :

  <script src="https://www.gstatic.com/firebasejs/5.7.0/firebase-firestore.js"></script>
  <script src="https://www.gstatic.com/firebasejs/5.7.0/firebase-storage.js"></script>
  <script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-auth.js"></script>
  <script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-database.js"></script>

我正在使用初始化应用程序:

I am initializing the app with :

 <script>
          var config = {
            apiKey: "AIzaSxxxxxxxxxxxxxxxZQ14",
            authDomain: "xxxxxx.firebaseapp.com",
            databaseURL: "https://xxxxxxx.firebaseio.com",
            projectId: "xxxxxx",
            storageBucket: "xxxxxxx.appspot.com",
            messagingSenderId: "xxxxxxxxx"
          };
          firebase.initializeApp(config);
          const db = firebase.firestore();
          db.settings({timestampsInSnapshots:true});
     </script>

而这些是我在此文件中拥有的与Firebase相关的唯一内容.

and those are the only things relate to Firebase I have in this file.

推荐答案

通过使用以下命令更改导入文件的版本来解决:(非常感谢Frank )

Solved by changing version of the imported files with : (thanks a lot Frank)

      <script src="https://www.gstatic.com/firebasejs/5.7.0/firebase-app.js"></script>
      <script src="https://www.gstatic.com/firebasejs/5.9.0/firebase-firestore.js"></script>
      <script src="https://www.gstatic.com/firebasejs/5.7.0/firebase-storage.js"></script>
      <script src="https://www.gstatic.com/firebasejs/5.9.0/firebase-auth.js"></script>
      <script src="https://www.gstatic.com/firebasejs/5.9.0/firebase-database.js"></script>
      <script src="https://www.gstatic.com/firebasejs/5.9.0/firebase-messaging.js"></script>
      <script src="https://www.gstatic.com/firebasejs/5.9.0/firebase-functions.js"></script>

这篇关于firebase.auth.RecaptchaVerifier不是构造函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆