File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-firebase-project-id
55NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET = your-firebase-storage-bucket
66NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID = your-firebase-messaging-sender-id
77NEXT_PUBLIC_FIREBASE_APP_ID = your-firebase-app-id
8+ NEXT_PUBLIC_FIREBASE_APP_CHECK_KEY = your-firebase-app-check-site-key
89
910# LINE LIFF Config
1011NEXT_PUBLIC_LINE_LIFF_ID = your-line-liff-id
Original file line number Diff line number Diff line change 4141 NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET : ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
4242 NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID : ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
4343 NEXT_PUBLIC_FIREBASE_APP_ID : ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
44+ NEXT_PUBLIC_FIREBASE_APP_CHECK_KEY : ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_CHECK_KEY }}
4445 NEXT_PUBLIC_LINE_LIFF_ID : ${{ secrets.NEXT_PUBLIC_LINE_LIFF_ID }}
4546
4647 - uses : FirebaseExtended/action-hosting-deploy@v0.9.0
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 DocumentData ,
1515} from "firebase/firestore" ;
1616import { getFunctions , httpsCallable } from "firebase/functions" ;
17+ import { initializeAppCheck , ReCaptchaV3Provider } from "firebase/app-check" ;
1718import type {
1819 AuthenticateLineUserParams ,
1920 AuthenticateLineUserResult ,
@@ -32,6 +33,22 @@ const firebaseConfig = {
3233// Initialize Firebase
3334const app =
3435 getApps ( ) . length === 0 ? initializeApp ( firebaseConfig ) : getApps ( ) [ 0 ] ;
36+
37+ if (
38+ typeof document !== "undefined" &&
39+ process . env . NEXT_PUBLIC_FIREBASE_APP_CHECK_KEY
40+ ) {
41+ initializeAppCheck ( app , {
42+ provider : new ReCaptchaV3Provider (
43+ process . env . NEXT_PUBLIC_FIREBASE_APP_CHECK_KEY
44+ ) ,
45+
46+ // Optional argument. If true, the SDK automatically refreshes App Check
47+ // tokens as needed.
48+ isTokenAutoRefreshEnabled : true ,
49+ } ) ;
50+ }
51+
3552const auth = getAuth ( app ) ;
3653const db = getFirestore ( app ) ;
3754const functions = getFunctions ( app , "asia-southeast1" ) ;
You can’t perform that action at this time.
0 commit comments