Firebase recaptchaVerifier 显示 Uncaught TypeError:

我正在尝试实施 firebase 电话身份验证,但我一直有 Uncaught TypeError: Cannot read property 'RecaptchaVerifier' of undefined。

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

请任何人帮助解决可能的前进方向?

<!DOCTYPE html>

<html>

    <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();

    </body>

</html>


开满天机
浏览 105回答 1
1回答

慕容708150

我看不到您在哪里添加了用于 Firebase Auth 的脚本:<script&nbsp;src="https://www.gstatic.com/firebasejs/7.24.0/firebase-auth.js"></script>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript