Skip to content

fix(android): App Check debug secret is not read from the manifest - #244

Closed
DropMatch wants to merge 1 commit into
firebase:mainfrom
DropMatch:fix-appcheck-debug-secret
Closed

DropMatch wants to merge 1 commit into
firebase:mainfrom
DropMatch:fix-appcheck-debug-secret

Conversation

@DropMatch

Copy link
Copy Markdown

The App Check section in firebase-basics/references/android_setup.md (and the same snippet in firebase-ai-logic-basics/references/usage_patterns_android.md) says this line pins the debug token for normal emulator runs:

manifestPlaceholders["firebaseAppCheckDebugSecret"] = appCheckDebugToken

As far as I can tell, nothing in App Check reads that value:

  • DebugAppCheckProvider uses an InternalDebugSecretProvider if one is registered, otherwise a UUID it generates once and keeps in SharedPreferences (source).
  • The only InternalDebugSecretProvider is DebugSecretProvider in firebase-appcheck-debug-testing, and it reads InstrumentationRegistry.getArguments() (source).
  • No App Check code reads manifest meta-data, and a placeholder does nothing unless the manifest uses it.

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 testInstrumentationRunnerArguments line is real, but it only works with firebase-appcheck-debug-testing, which the section never adds.

This PR:

  • removes the manifestPlaceholders line and says normal debug runs get a per-install token that has to be registered for each device or emulator
  • keeps the fixed token for instrumentation tests, adding the androidTestImplementation dependency and a DebugAppCheckTestHelper example (withDebugProvider<Exception>, since Kotlin can't infer the type parameter otherwise; checked that it compiles)

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.

🤖 Generated with Claude Code

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@google-cla

google-cla Bot commented Nov 1, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Android documentation for Firebase App Check, clarifying how debug tokens are handled and registered. It corrects previous misconceptions about manifest placeholders and BuildConfig fields, and adds clear guidelines and code snippets for setting up instrumentation tests using firebase-appcheck-debug-testing and DebugAppCheckTestHelper. The review feedback suggests adding the necessary imports to the Kotlin code snippet for installing the debug provider to make it fully self-contained.

Comment on lines +195 to +199
if (BuildConfig.DEBUG) {
Firebase.appCheck.installAppCheckProviderFactory(
DebugAppCheckProviderFactory.getInstance()
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the Kotlin code snippet fully self-contained and easy to copy-paste, consider including the necessary imports for Firebase, appCheck, and DebugAppCheckProviderFactory.

Suggested change
if (BuildConfig.DEBUG) {
Firebase.appCheck.installAppCheckProviderFactory(
DebugAppCheckProviderFactory.getInstance()
)
}
import com.google.firebase.Firebase
import com.google.firebase.appcheck.appCheck
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory
if (BuildConfig.DEBUG) {
Firebase.appCheck.installAppCheckProviderFactory(
DebugAppCheckProviderFactory.getInstance()
)
}

@DropMatch DropMatch closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant