简体   繁体   English

Firebase recaptchaVerifier 显示未捕获的类型错误:无法读取未定义的属性“RecaptchaVerifier”

[英]Firebase recaptchaVerifier showing Uncaught TypeError: Cannot read property 'RecaptchaVerifier' of undefined

I am trying to implement firebase phone authentication but i kept having Uncaught TypeError: Cannot read property 'RecaptchaVerifier' of undefined.我正在尝试实施 firebase 电话身份验证,但我一直遇到未捕获的类型错误:无法读取未定义的属性“RecaptchaVerifier”。

Below is the code sample i am using下面是我正在使用的代码示例

Please can anyone help with possible ways forward?请任何人帮助解决可能的前进方向?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body class="body-film">
        <h1>Enter Phone Number</h1>
        <form>
            <input type="text" id="number" placeholder="080******" />
            <div id="recaptcha-container"></div>
            <button type="button" onclick="phoneAuth();">Send Code</button>
        </form><br />

        <h1>Enter OTP</h1>
        <form>
            <input type="text" id="verificationCode" placeholder="OTP HERE" />
            <button type="button" onclick="codeverify();">VERIFY OTP</button>
        </form>

        
        
        <!-- The core Firebase JS SDK is always required and must be listed first -->
        <script src="https://www.gstatic.com/firebasejs/7.24.0/firebase-app.js"></script>

        <!-- TODO: Add SDKs for Firebase products that you want to use
             https://firebase.google.com/docs/web/setup#available-libraries -->
        <script src="https://www.gstatic.com/firebasejs/7.24.0/firebase-analytics.js"></script>

        <script>
          // Your web app's Firebase configuration
          // For Firebase JS SDK v7.20.0 and later, measurementId is optional
          var firebaseConfig = {
            apiKey: "*****************",
            authDomain: "*****************",
            databaseURL: "*****************",
            projectId: "*****************",
            storageBucket: "*****************",
            messagingSenderId: "*****************",
            appId: "*****************",
            measurementId: "*****************"
          };
          // Initialize Firebase
          firebase.initializeApp(firebaseConfig);
          firebase.analytics();

         window.onload = function(){
            render();
         }
         function render(){
            window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
            recaptchaVerifier.render();
         }
        </script>

    </body>
</html>

I don't see where you've added the script include for Firebase Auth:我看不到您在哪里添加了 Firebase Auth 的脚本包含:

<script src="https://www.gstatic.com/firebasejs/7.24.0/firebase-auth.js"></script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的类型错误:无法读取未定义的属性“initializeApp” - Uncaught TypeError: Cannot read property 'initializeApp' of undefined Firebase RecaptchaVerifier.clear() 没有效果 - Firebase RecaptchaVerifier.clear() has no effect Firebase,类型错误:无法读取未定义的属性“错误” - Firebase, TypeError: Cannot read property 'error' of undefined 类型错误:无法读取未定义的属性“地图”:firebase 和 angular 日历 - TypeError: Cannot read property 'map' of undefined : firebase with angular calendar 错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“id” - ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'id' of undefined Flutter web 和 Firebase 身份验证类型错误:无法读取未定义的属性“应用程序” - Flutter web and Firebase authentication TypeError: Cannot read property 'app' of undefined 类型错误:无法读取未定义的属性“_fieldsProto” - TypeError: Cannot read property '_fieldsProto' of undefined 类型错误:无法读取未定义的属性“ref” - TypeError: Cannot read property 'ref' of undefined 未捕获的类型错误:无法解构“未定义”的属性“getFirestore”,因为它是未定义的 - Uncaught TypeError: Cannot destructure property 'getFirestore' of 'undefined' as it is undefined 验证令牌类型错误时出错:无法读取未定义的属性“数据” firebase nodejs - Error while verifying token TypeError: Cannot read property 'data' of undefined firebase nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM