Integrate Firebase App Check

This commit is contained in:
2022-10-24 15:14:26 +02:00
parent 477a1b44bd
commit 23cd41bd48
2 changed files with 13 additions and 0 deletions

View File

@@ -57,6 +57,10 @@ export default {
middleware: 'auth' middleware: 'auth'
}, },
env: {
firebaseAppCheckDebugToken: process.env.NODE_ENV !== 'production'
},
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
vuetify: { vuetify: {
customVariables: ['~/assets/variables.scss'], customVariables: ['~/assets/variables.scss'],

View File

@@ -1,6 +1,7 @@
import { initializeApp } from 'firebase/app' import { initializeApp } from 'firebase/app'
import { getAuth } from 'firebase/auth' import { getAuth } from 'firebase/auth'
import { getFirestore } from 'firebase/firestore' import { getFirestore } from 'firebase/firestore'
import { initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check'
// Firebase configuration // Firebase configuration
const firebaseConfig = { const firebaseConfig = {
@@ -15,6 +16,14 @@ const firebaseConfig = {
// Initialize Firebase // Initialize Firebase
const app = initializeApp(firebaseConfig) const app = initializeApp(firebaseConfig)
// Initialize Firebase App Check
self.FIREBASE_APPCHECK_DEBUG_TOKEN = process.env.firebaseAppCheckDebugToken
initializeAppCheck(app, {
provider: new ReCaptchaV3Provider('6LcrDqoiAAAAALVT6mjDGTj8EMjukfkQJqxnZ2SA'),
// Optional argument. If true, the SDK automatically refreshes App Check tokens as needed.
isTokenAutoRefreshEnabled: true
})
// Initialize Firebase Authentication and get a reference to the service // Initialize Firebase Authentication and get a reference to the service
const auth = getAuth(app) const auth = getAuth(app)