Javascript Firebase recaptchaVerifier显示未捕获类型错误:无法读取属性';雷帕查弗里耶';未定义的

Javascript Firebase recaptchaVerifier显示未捕获类型错误:无法读取属性';雷帕查弗里耶';未定义的,javascript,firebase-authentication,Javascript,Firebase Authentication,我正在尝试实现firebase电话身份验证,但一直存在未捕获的类型错误:无法读取未定义的属性“RecaptchaVerifier” 下面是我正在使用的代码示例 请问有谁能帮助我们找到可能的前进之路 <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; c

我正在尝试实现firebase电话身份验证,但一直存在未捕获的类型错误:无法读取未定义的属性“RecaptchaVerifier”

下面是我正在使用的代码示例

请问有谁能帮助我们找到可能的前进之路

<!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>

输入电话号码
发送代码

输入OTP 验证OTP //您的web应用程序的Firebase配置 //对于Firebase JS SDK v7.20.0及更高版本,measurementId是可选的 var firebaseConfig={ apiKey:“****************”, authDomain:“*******************”, 数据库URL:“****************”, 项目D:“****************”, storageBucket:“****************”, messagingSenderId:“*******************”, appId:“****************”, 度量标准:“*****************” }; //初始化Firebase firebase.initializeApp(firebaseConfig); firebase.analytics(); window.onload=函数(){ render(); } 函数render(){ window.recaptchaVerifier=new firebase.auth.recaptchaVerifier('recaptcha-container'); recaptchaVerifier.render(); }
我看不出您在何处添加了用于Firebase Auth的脚本include:

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

非常感谢。我没有足够的声望投票支持你,但我很感激