我已经在我的Firebase console
中为我的web应用注册了我的reCAPTCHA v3
密钥。现在我想在我的客户端添加应用检查SDK。这些是我在我的index.html
中的导入:
<script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-database-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-auth-compat.js"></script>`
<script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-app-check-compat.js" async defer></script>
<script src="https://www.google.com/recaptcha/api.js?render=MY_SITE_KEY_HERE" async defer></script>
这是我的javascript
:
const firebaseConfig = {
apiKey: "ABCDEF",
authDomain: "ABCDEFGH.firebaseapp.com",
projectId: "ABCDEFGHO",
storageBucket: "project_name.appspot.com",
messagingSenderId: "123456789",
databaseURL: "https://project)name.firebaseio.com",
appId: "1:12345678:web:f4r3rsdf322e112c800"
};
firebase.initializeApp(firebaseConfig);
document.getElementById("submit").addEventListener("click",function(event){
firebase.initializeAppCheck(firebase.initializeApp(firebaseConfig),{
provider: new ReCaptchaV3Provider('MY_SITE_KEY_HERE'),
isTokenAutoRefreshEnabled: true
});
})
单击submit
按钮时,控制台中弹出以下错误:
未捕获(在承诺中)引用错误:未定义ReCaptchaV3提供程序
如何修复此问题?这是安装应用检查SDK的正确方法吗?
1条答案
按热度按时间tjrkku2a1#
您需要添加导入代码