[英]How do I add the Firebase app check SDK in my web app?
I have registered my reCAPTCHA v3
secret key in my Firebase console
for my web app.我已经在我的 web 应用程序的Firebase console
中注册了我的reCAPTCHA v3
密钥。 Now I want to add the app check SDK in my client side.现在我想在我的客户端添加应用程序检查 SDK。 These are my imports in my index.html
:这些是我在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>
This is my javascript
:这是我的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
});
})
Upon clicking the submit
button, this error pops up in my console:单击submit
按钮后,此错误会在我的控制台中弹出:
Uncaught (in promise) ReferenceError: ReCaptchaV3Provider is not defined未捕获(承诺)ReferenceError:未定义 ReCaptchaV3Provider
How do I fix this?我该如何解决? Is this the correct way to install the app check SDK?这是安装应用程序检查 SDK 的正确方法吗?
you need add import code您需要添加导入代码
import {ReCaptchaV3Provider} from "firebase/app-check"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.