Flutter ile hata ayıklama sağlayıcısıyla Uygulama Kontrolü'nü kullanma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Uygulamanızı Uygulama Kontrolü'ne kaydettikten sonra, bu ortamlar geçerli cihaz olarak kabul edilmediğinden uygulamanız normalde bir emülatörde veya sürekli entegrasyon (CI) ortamında çalışmaz. Geliştirme ve test sırasında uygulamanızı bu tür bir ortamda çalıştırmak istiyorsanız uygulamanızın gerçek bir onay sağlayıcı yerine Uygulama Kontrolü hata ayıklama sağlayıcısını kullanan bir hata ayıklama derlemesini oluşturabilirsiniz.
Apple platformları
Uygulamanızı bir simülatörde etkileşimli olarak (ör. geliştirme sırasında) çalıştırırken hata ayıklama sağlayıcısını kullanmak için aşağıdakileri yapın:
Firebase uygulamanızı başlattıktan hemen sonra hata ayıklama sağlayıcısıyla Uygulama Kontrolü'nü etkinleştirin:
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());}
Xcode projenizde hata ayıklama günlük kaydını etkinleştirin (v11.0 veya daha yeni sürümler):
Soldaki menüden Run'ı (Çalıştır) ve ardından Arguments (Bağımsız değişkenler) sekmesini seçin.
Arguments Passed on Launch (Başlatmada İletilen Parametreler) bölümüne -FIRDebugEnabled ekleyin.
ios/Runner.xcworkspace dosyasını Xcode ile açın ve uygulamanızı simülatörde çalıştırın.
Firebase, arka uca istek göndermeye çalıştığında uygulamanız hata ayıklama çıkışına yerel bir hata ayıklama jetonu yazdırır. Örneğin:
Firebase konsolunun App Check bölümünde, uygulamanızın taşma menüsünden Hata ayıklama jetonlarını yönet'i seçin. Ardından, önceki adımda oturum açtığınız hata ayıklama jetonunu kaydedin.
Jetonu kaydettikten sonra Firebase arka uç hizmetleri bunu geçerli olarak kabul eder.
Bu jeton, geçerli bir cihaz olmadan Firebase kaynaklarınıza erişime izin verdiğinden gizli tutmanız çok önemlidir. Herkese açık bir depoya göndermeyin. Kayıtlı bir jetonun güvenliği ihlal edilirse Firebase konsolunda hemen iptal edin.
Android
Flutter uygulamanızı Android ortamında çalıştırırken hata ayıklama sağlayıcısını kullanmak için Flutter uygulamanızda aşağıdaki kodu uygulayın:
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, arka uca istek göndermeye çalıştığında uygulamanız hata ayıklama çıkışına yerel bir hata ayıklama jetonu yazdırır. Örneğin:
D DebugAppCheckProvider: Enter this debug secret into the allow list in
the Firebase Console for your project: 123a4567-b89c-12d3-e456-789012345678
Firebase konsolunun App Check bölümünde, uygulamanızın taşma menüsünden Hata ayıklama jetonlarını yönet'i seçin. Ardından, önceki adımda oturum açtığınız hata ayıklama jetonunu kaydedin.
Jetonu kaydettikten sonra Firebase arka uç hizmetleri bunu geçerli olarak kabul eder.
Web
Uygulamanızı localhost konumundan çalıştırırken (örneğin, geliştirme sırasında) hata ayıklama sağlayıcısını kullanmak için aşağıdakileri yapın:
web/index.html dosyasında, self.FIREBASE_APPCHECK_DEBUG_TOKEN değerini true olarak ayarlayarak hata ayıklama modunu etkinleştirin:
Web uygulamanızı yerel olarak çalıştırın ve tarayıcının geliştirici aracını açın. Hata ayıklama konsolunda bir hata ayıklama jetonu görürsünüz:
AppCheck debug token: "123a4567-b89c-12d3-e456-789012345678". You will
need to safelist it in the Firebase console for it to work.
Bu jeton, tarayıcınızda yerel olarak depolanır ve uygulamanızı aynı makinede aynı tarayıcıda her kullandığınızda kullanılır. Jetonu başka bir tarayıcıda veya başka bir makinede kullanmak istiyorsanız self.FIREBASE_APPCHECK_DEBUG_TOKEN değerini true yerine jeton dizesi olarak ayarlayın.
Firebase konsolunun App Check bölümünde, uygulamanızın taşma menüsünden Hata ayıklama jetonlarını yönet'i seçin. Ardından, önceki adımda oturum açtığınız hata ayıklama jetonunu kaydedin.
Jetonu kaydettikten sonra Firebase arka uç hizmetleri bunu geçerli olarak kabul eder.
Bu jeton, geçerli bir cihaz olmadan Firebase kaynaklarınıza erişime izin verdiğinden gizli tutmanız çok önemlidir. Herkese açık bir depoya göndermeyin. Kayıtlı bir jetonun güvenliği ihlal edilirse Firebase konsolunda hemen iptal edin.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-23 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."]]