A Firebase App Check provider that can exchange a debug token registered
in the Firebase console for a Firebase App Check token. The debug provider
is designed to enable testing applications on a simulator or test
environment.
NOTE: Do not use the debug provider in applications used by real users.
WARNING: Keep the Firebase App Check debug token secret. If you
accidentally share one (e.g. commit to a public source repo), remove it in
the Firebase console ASAP.
To use AppCheckDebugProvider on a local simulator:
Configure AppCheckDebugProviderFactory before FirebaseApp.configure():
AppCheck.setAppCheckProviderFactory(AppCheckDebugProviderFactory())
2. Enable debug logging by adding the -FIRDebugEnabled launch argument to
the app target.
3. Launch the app. A local debug token will be logged when Firebase is
configured. For example:
“[Firebase/AppCheck][I-FAA001001] Firebase App Check Debug Token:
‘3BA09C8C-8A0D-4030-ACD5-B96D99DB73F9’”.
4. Register the debug token in the Firebase console.
Once the debug token is registered the debug provider will be able to provide a valid Firebase
App Check token.
To use AppCheckDebugProvider on a simulator on a build server:
Create a new Firebase App Check debug token in the Firebase console
Add the debug token to the secure storage of your build environment. E.g. see Encrypted
secrets for GitHub Actions,
etc.
Configure AppCheckDebugProviderFactory before FirebaseApp.configure()AppCheck.setAppCheckProviderFactory(AppCheckDebugProviderFactory())
Add an environment variable to the scheme with a name FIRAAppCheckDebugToken and value like
$(MY_APP_CHECK_DEBUG_TOKEN).
Configure the build script to pass the debug token as the environment variable, e.g.:
xcodebuild test -scheme InstallationsExample -workspace InstallationsExample.xcworkspace \
MY_APP_CHECK_DEBUG_TOKEN=$(MY_SECRET_ON_CI)
Returns a new Firebase App Check token.
When implementing this method for your custom provider, the token returned should be suitable
for consumption in a limited-use scenario. If you do not implement this method, the
getTokenWithCompletion will be invoked instead whenever a limited-use token is requested.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-11 UTC."],[],[],null,["# FirebaseAppCheck Framework Reference\n\nAppCheckDebugProvider\n=====================\n\n class AppCheckDebugProvider : NSObject, ../Protocols/AppCheckProvider.html\n\nA Firebase App Check provider that can exchange a debug token registered\nin the Firebase console for a Firebase App Check token. The debug provider\nis designed to enable testing applications on a simulator or test\nenvironment.\n\nNOTE: Do not use the debug provider in applications used by real users.\n\nWARNING: Keep the Firebase App Check debug token secret. If you\naccidentally share one (e.g. commit to a public source repo), remove it in\nthe Firebase console ASAP.\n\nTo use `AppCheckDebugProvider` on a local simulator:\n\n1. Configure [AppCheckDebugProviderFactory](../Classes.html#/c:objc(cs)FIRAppCheckDebugProviderFactory) before `FirebaseApp.configure()`: `AppCheck.setAppCheckProviderFactory(AppCheckDebugProviderFactory())` 2. Enable debug logging by adding the `-FIRDebugEnabled` launch argument to the app target. 3. Launch the app. A local debug token will be logged when Firebase is configured. For example: \"\\[Firebase/AppCheck\\]\\[I-FAA001001\\] Firebase App Check Debug Token: '3BA09C8C-8A0D-4030-ACD5-B96D99DB73F9'\". 4. Register the debug token in the Firebase console.\n\nOnce the debug token is registered the debug provider will be able to provide a valid Firebase\nApp Check token.\n\nTo use `AppCheckDebugProvider` on a simulator on a build server:\n\n1. Create a new Firebase App Check debug token in the Firebase console\n2. Add the debug token to the secure storage of your build environment. E.g. see [Encrypted\n secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) for GitHub Actions, etc.\n3. Configure [AppCheckDebugProviderFactory](../Classes.html#/c:objc(cs)FIRAppCheckDebugProviderFactory) before `FirebaseApp.configure()` `AppCheck.setAppCheckProviderFactory(AppCheckDebugProviderFactory())`\n4. Add an environment variable to the scheme with a name `FIRAAppCheckDebugToken` and value like `$(MY_APP_CHECK_DEBUG_TOKEN)`.\n5. Configure the build script to pass the debug token as the environment variable, e.g.: `xcodebuild test -scheme InstallationsExample -workspace InstallationsExample.xcworkspace \\\n MY_APP_CHECK_DEBUG_TOKEN=$(MY_SECRET_ON_CI)`\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)FIRAppCheckDebugProvider(im)init)\n\n `\n ` \n Unavailable \n Undocumented\n- `\n ``\n ``\n `\n\n ### [init(app:)](#/c:objc(cs)FIRAppCheckDebugProvider(im)initWithApp:)\n\n `\n ` \n Undocumented \n\n #### Declaration\n\n Swift \n\n init?(app: FIRApp)\n\n- `\n ``\n ``\n `\n\n ### [localDebugToken()](#/c:objc(cs)FIRAppCheckDebugProvider(im)localDebugToken)\n\n `\n ` \n Return the locally generated token. \n\n #### Declaration\n\n Swift \n\n func localDebugToken() -\u003e String\n\n- `\n ``\n ``\n `\n\n ### [currentDebugToken()](#/c:objc(cs)FIRAppCheckDebugProvider(im)currentDebugToken)\n\n `\n ` \n Returns the currently used App Check debug token. The priority:\n - - `FIRAAppCheckDebugToken` env variable value\n - - A previously generated token, stored locally on the device\n - - A newly generated random token. The generated token will be stored\n - locally for future use\n - - returns: The currently used App Check debug token. \n\n #### Declaration\n\n Swift \n\n func currentDebugToken() -\u003e String\n\n- `\n ``\n ``\n `\n\n ### [getToken()](#/c:objc(cs)FIRAppCheckDebugProvider(im)getTokenWithCompletion:)\n\n `\n ` \n Returns a new Firebase App Check token. \n\n #### Declaration\n\n Swift \n\n func getToken() async throws -\u003e FIRAppCheckToken\n\n #### Parameters\n\n |-----------------|----------------------------------------------------------------------------------------|\n | ` `*handler*` ` | The completion handler. Make sure to call the handler with either a token or an error. |\n\n- `\n ``\n ``\n `\n\n ### [getLimitedUseToken()](#/c:objc(cs)FIRAppCheckDebugProvider(im)getLimitedUseTokenWithCompletion:)\n\n `\n ` \n Returns a new Firebase App Check token.\n When implementing this method for your custom provider, the token returned should be suitable\n for consumption in a limited-use scenario. If you do not implement this method, the\n getTokenWithCompletion will be invoked instead whenever a limited-use token is requested. \n\n #### Declaration\n\n Swift \n\n func getLimitedUseToken() async throws -\u003e FIRAppCheckToken\n\n #### Parameters\n\n |-----------------|----------------------------------------------------------------------------------------|\n | ` `*handler*` ` | The completion handler. Make sure to call the handler with either a token or an error. |"]]