앱 체크에 앱을 등록하면 일반적으로 에뮬레이터 또는 지속적 통합(CI) 환경에서 앱이 실행되지 않습니다. 이러한 환경은 유효한 기기로 인정되지 않기 때문입니다. 개발 및 테스트 중에 이러한 환경에서 앱을 실행하려면 실제 증명 제공자 대신 앱 체크 디버그 제공자를 사용하는 앱의 디버그 빌드를 만들면 됩니다.
Apple 플랫폼
시뮬레이터에서 대화형으로 앱을 실행하는 동안(예: 개발 중에) 디버그 제공자를 사용하려면 다음 안내를 따르세요.
Firebase 앱을 초기화한 직후 디버그 제공자로 앱 체크를 활성화합니다.
import'package:flutter/material.dart';import'package:firebase_core/firebase_core.dart';// Import the firebase_app_check pluginimport'package:firebase_app_check/firebase_app_check.dart';Future<void>main()async{WidgetsFlutterBinding.ensureInitialized();awaitFirebase.initializeApp();awaitFirebaseAppCheck.instance.activate(// Set appleProvider to `AppleProvider.debug`appleProvider:AppleProvider.debug,);runApp(App());}
Firebase Console의 App Check 섹션에 있는 앱의 더보기 메뉴에서 디버그 토큰 관리를 선택합니다. 그런 다음 이전 단계에서 로깅한 디버그 토큰을 등록합니다.
토큰을 등록하면 Firebase 백엔드 서비스에서 토큰을 유효한 것으로 간주합니다.
이 토큰은 유효한 기기 없이도 Firebase 리소스에 액세스를 허용하므로 비공개로 유지하는 것이 중요합니다. 공개 저장소에 커밋하지 말고 등록된 토큰이 손상된 경우 Firebase Console에서 즉시 취소합니다.
Android
Android 환경에서 Flutter 앱을 실행하는 동안 디버그 제공자를 사용하려면 Flutter 애플리케이션에서 다음 코드를 구현합니다.
import'package:flutter/material.dart';import'package:firebase_core/firebase_core.dart';// Import the firebase_app_check pluginimport'package:firebase_app_check/firebase_app_check.dart';Future<void>main()async{WidgetsFlutterBinding.ensureInitialized();awaitFirebase.initializeApp();awaitFirebaseAppCheck.instance.activate(webRecaptchaSiteKey:'recaptcha-v3-site-key',// Set androidProvider to `AndroidProvider.debug`androidProvider:AndroidProvider.debug,);runApp(App());}
Firebase가 백엔드로 요청을 보내려고 하면 앱에서 로컬 디버그 토큰을 디버그 출력에 출력합니다. 예를 들면 다음과 같습니다.
D DebugAppCheckProvider: Enter this debug secret into the allow list in
the Firebase Console for your project: 123a4567-b89c-12d3-e456-789012345678
Firebase Console의 App Check 섹션에 있는 앱의 더보기 메뉴에서 디버그 토큰 관리를 선택합니다. 그런 다음 이전 단계에서 로깅한 디버그 토큰을 등록합니다.
토큰을 등록하면 Firebase 백엔드 서비스에서 토큰을 유효한 것으로 간주합니다.
웹
localhost에서 앱을 실행하는 동안(예: 개발 중에) 디버그 제공자를 사용하려면 다음을 수행합니다.
web/index.html 파일에서 self.FIREBASE_APPCHECK_DEBUG_TOKEN을 true로 설정하여 디버그 모드를 사용 설정합니다.
[null,null,["최종 업데이트: 2025-08-28(UTC)"],[],[],null,["After you have registered your app for App Check, your app normally won't run\nin an emulator or from a continuous integration (CI) environment, since those\nenvironments don't qualify as valid devices. If you want to run your app in such\nan environment during development and testing, you can create a debug build of\nyour app that uses the App Check debug provider instead of a real attestation\nprovider.\n| **Warning:** The debug provider allows access to your Firebase resources from unverified devices. Don't use the debug provider in production builds of your app, and don't share your debug builds with untrusted parties.\n\nApple platforms\n\nTo use the debug provider while running your app in a simulator interactively\n(during development, for example), do the following:\n\n1. Activate App Check with the debug provider right after you have initialized\n your Firebase app:\n\n import 'package:flutter/material.dart';\n import 'package:firebase_core/firebase_core.dart';\n\n // Import the firebase_app_check plugin\n import 'package:firebase_app_check/firebase_app_check.dart';\n\n Future\u003cvoid\u003e main() async {\n WidgetsFlutterBinding.ensureInitialized();\n await Firebase.initializeApp();\n await FirebaseAppCheck.instance.activate(\n // Set appleProvider to `AppleProvider.debug`\n appleProvider: AppleProvider.debug,\n );\n runApp(App());\n }\n\n2. Enable debug logging in your Xcode project (v11.0 or newer):\n\n 1. Open **Product \\\u003e Scheme \\\u003e Edit scheme**.\n 2. Select **Run** from the left menu, then select the **Arguments** tab.\n 3. In the **Arguments Passed on Launch** section, add `-FIRDebugEnabled`.\n3. Open `ios/Runner.xcworkspace` with Xcode and run your app in the Simulator.\n Your app will print a local debug token to the debug output when Firebase\n tries to send a request to the backend. For example:\n\n ```\n Firebase App Check Debug Token:\n 123a4567-b89c-12d3-e456-789012345678\n ```\n4. In the [**App Check**](//console.firebase.google.com/project/_/appcheck) section\n of the Firebase console, choose **Manage debug tokens** from your app's\n overflow menu. Then, register the debug token you logged in the previous\n step.\n\nAfter you register the token, Firebase backend services will accept it as valid.\n\nBecause this token allows access to your Firebase resources without a\nvalid device, it is crucial that you keep it private. Don't commit it to a\npublic repository, and if a registered token is ever compromised, revoke it\nimmediately in the Firebase console.\n\nAndroid\n\nTo use the debug provider while running your Flutter app in an Android environment,\nimplement the following code in your Flutter application: \n\n import 'package:flutter/material.dart';\n import 'package:firebase_core/firebase_core.dart';\n\n // Import the firebase_app_check plugin\n import 'package:firebase_app_check/firebase_app_check.dart';\n\n Future\u003cvoid\u003e main() async {\n WidgetsFlutterBinding.ensureInitialized();\n await Firebase.initializeApp();\n await FirebaseAppCheck.instance.activate(\n webRecaptchaSiteKey: 'recaptcha-v3-site-key',\n // Set androidProvider to `AndroidProvider.debug`\n androidProvider: AndroidProvider.debug,\n );\n runApp(App());\n }\n\nYour app will print a local debug token to the debug output when Firebase tries\nto send a request to the backend. For example: \n\n```\nD DebugAppCheckProvider: Enter this debug secret into the allow list in\nthe Firebase Console for your project: 123a4567-b89c-12d3-e456-789012345678\n```\n\n1. In the [**App Check**](//console.firebase.google.com/project/_/appcheck) section\n of the Firebase console, choose **Manage debug tokens** from your app's\n overflow menu. Then, register the debug token you logged in the previous\n step.\n\nAfter you register the token, Firebase backend services will accept it as valid.\n\nWeb\n\nTo use the debug provider while running your app from `localhost` (during\ndevelopment, for example), do the following:\n| **Warning:** *Do not* try to enable `localhost` debugging by adding `localhost` to reCAPTCHA's allowed domains. Doing so would allow anyone to run your app from their local machines!\n\n1. In the file `web/index.html`, enable debug mode by setting\n `self.FIREBASE_APPCHECK_DEBUG_TOKEN` to `true`:\n\n \u003cbody\u003e\n \u003cscript\u003e\n self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;\n \u003c/script\u003e\n\n ...\n\n \u003c/body\u003e\n\n2. Run your web app locally and open the browser's developer tool. In the\n debug console, you'll see a debug token:\n\n ```\n AppCheck debug token: \"123a4567-b89c-12d3-e456-789012345678\". You will\n need to safelist it in the Firebase console for it to work.\n ```\n\n This token is stored locally in your browser and will be used whenever you\n use your app in the same browser on the same machine. If you want to use the\n token in another browser or on another machine, set\n `self.FIREBASE_APPCHECK_DEBUG_TOKEN` to the token string instead of `true`.\n3. In the [**App Check**](//console.firebase.google.com/project/_/appcheck) section\n of the Firebase console, choose **Manage debug tokens** from your app's\n overflow menu. Then, register the debug token you logged in the previous\n step.\n\nAfter you register the token, Firebase backend services will accept it as valid.\n\nBecause this token allows access to your Firebase resources without a\nvalid device, it is crucial that you keep it private. Don't commit it to a\npublic repository, and if a registered token is ever compromised, revoke it\nimmediately in the Firebase console."]]