Skip to content

feat: Only log local debug tokens when not yet registered#95

Merged
ncooke3 merged 6 commits into
mainfrom
ah/debug-token-logging
Jun 10, 2026
Merged

feat: Only log local debug tokens when not yet registered#95
ncooke3 merged 6 commits into
mainfrom
ah/debug-token-logging

Conversation

@andrewheard

@andrewheard andrewheard commented May 27, 2026

Copy link
Copy Markdown
Collaborator

This will go into upcoming AppCheckCore 11.3.0.

Updated GACAppCheckDebugProvider to only log the local debug token at app startup if it has not yet been successfully used. If the debug token has already been successfully exchanged for an App Check token in a previous run then it has already been registered in the Firebase Console. By only logging when necessary, developers may be more likely to notice when they need to re-register a debug token, such as when switching simulators or devices.

Updated `GACAppCheckDebugProvider` to only log the local debug token at app startup if it has not
yet been successfully used. If the debug token has already been successfully exchanged for an App
Check token in a previous run then it has already been registered in the Firebase Console. By only
logging when necessary, developers may be more likely to notice when they need to re-register a
debug token, such as when switching simulators or devices.
@andrewheard andrewheard marked this pull request as ready for review May 28, 2026 22:19
@ncooke3 ncooke3 self-requested a review June 9, 2026 18:54

@ncooke3 ncooke3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm exploring one small fix. The debug token is stored in a centralized spot. This registration flag should be on a per app basis, to avoid inaccuracies.

@ncooke3

ncooke3 commented Jun 9, 2026

Copy link
Copy Markdown
Member

I'm exploring one small fix. The debug token is stored in a centralized spot. This registration flag should be on a per app basis, to avoid inaccuracies.

To support multi-app environments (e.g., running multiple Firebase apps or configurations in the same simulator), namespace the debug token registration status flag stored in UserDefaults.
Previously, a single global key GACAppCheckDebugTokenRegistered was used. This caused collisions where registering the debug token for one app would incorrectly mark it as registered for all other apps sharing the simulator.
Now, the registration key is namespaced using both serviceName (local app name) and resourceName (Project ID + App ID), conforming to the storage isolation patterns used elsewhere in the App Check SDK (e.g., App Attest).

  • Updated GACAppCheckDebugProvider to generate the namespaced key.
  • Updated internal initializers to accept and propagate both parameters.
  • Updated unit tests to verify namespaced key generation and sanitization.

@ncooke3 ncooke3 requested a review from paulb777 June 9, 2026 22:22
@ncooke3 ncooke3 requested a review from daymxn June 9, 2026 22:32
@ncooke3

ncooke3 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Self: After merging, move release tag.

@ncooke3 ncooke3 merged commit bb40024 into main Jun 10, 2026
24 checks passed
@ncooke3 ncooke3 deleted the ah/debug-token-logging branch June 10, 2026 15:30
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.

3 participants