Repository navigation
Conversation
The App Check sections told agents that a manifestPlaceholders entry pins the debug secret for normal debug runs. DebugAppCheckProvider never reads manifest meta-data: it uses a registered InternalDebugSecretProvider, which only firebase-appcheck-debug-testing supplies (from instrumentation arguments), and otherwise a per-install UUID kept in SharedPreferences. Drop the placeholder, say normal debug runs need each install's token registered, and show the fixed-secret setup for instrumentation tests with firebase-appcheck-debug-testing and DebugAppCheckTestHelper.
There was a problem hiding this comment.
Code Review
This pull request updates the Android App Check documentation in usage_patterns_android.md and android_setup.md to clarify how debug tokens are generated and stored, noting that manifest placeholders and BuildConfig fields do not affect normal debug runs. It also introduces instructions and code examples for using firebase-appcheck-debug-testing and DebugAppCheckTestHelper for instrumentation tests. The review feedback suggests adding the necessary import statements to the Kotlin code snippets in both files to make them fully self-contained and easier to copy-paste.
| DebugAppCheckTestHelper.fromInstrumentationArgs().withDebugProvider<Exception> { | ||
| // Firebase AI Logic calls | ||
| } |
There was a problem hiding this comment.
To make this code snippet fully self-contained and easy to copy-paste, please include the import statement for DebugAppCheckTestHelper.
| DebugAppCheckTestHelper.fromInstrumentationArgs().withDebugProvider<Exception> { | |
| // Firebase AI Logic calls | |
| } | |
| import com.google.firebase.appcheck.debug.testing.DebugAppCheckTestHelper | |
| DebugAppCheckTestHelper.fromInstrumentationArgs().withDebugProvider<Exception> { | |
| // Firebase AI Logic calls | |
| } |
| @Test | ||
| fun readsProtectedData() { | ||
| DebugAppCheckTestHelper.fromInstrumentationArgs().withDebugProvider<Exception> { | ||
| // Calls to App Check-protected Firebase services | ||
| } | ||
| } |
There was a problem hiding this comment.
To make this test snippet fully self-contained and easy to copy-paste, please include the import statements for DebugAppCheckTestHelper and Test.
| @Test | |
| fun readsProtectedData() { | |
| DebugAppCheckTestHelper.fromInstrumentationArgs().withDebugProvider<Exception> { | |
| // Calls to App Check-protected Firebase services | |
| } | |
| } | |
| import com.google.firebase.appcheck.debug.testing.DebugAppCheckTestHelper | |
| import org.junit.Test | |
| @Test | |
| fun readsProtectedData() { | |
| DebugAppCheckTestHelper.fromInstrumentationArgs().withDebugProvider<Exception> { | |
| // Calls to App Check-protected Firebase services | |
| } | |
| } |
The App Check section in
firebase-basics/references/android_setup.md(and the same snippet infirebase-ai-logic-basics/references/usage_patterns_android.md) says this line pins the debug token for normal emulator runs:As far as I can tell, nothing in App Check reads that value:
DebugAppCheckProvideruses anInternalDebugSecretProviderif one is registered, otherwise a UUID it generates once and keeps in SharedPreferences (source).InternalDebugSecretProviderisDebugSecretProviderinfirebase-appcheck-debug-testing, and it readsInstrumentationRegistry.getArguments()(source).So a normal debug launch still gets a new token per install, and an agent following the skill will believe the token is pinned when it isn't. The
testInstrumentationRunnerArgumentsline is real, but it only works withfirebase-appcheck-debug-testing, which the section never adds.This PR:
manifestPlaceholdersline and says normal debug runs get a per-install token that has to be registered for each device or emulatorandroidTestImplementationdependency and aDebugAppCheckTestHelperexample (withDebugProvider<Exception>, since Kotlin can't infer the type parameter otherwise)If a manifest-based secret for normal debug runs is meant to work, then this is an SDK gap rather than a docs one, and I'm happy to open an issue on firebase-android-sdk instead.