feat(appcheck): Verify one-time tokens for replay protection - #976
Open
yvonnep165 wants to merge 6 commits into
Open
feat(appcheck): Verify one-time tokens for replay protection#976yvonnep165 wants to merge 6 commits into
yvonnep165 wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for stateful token verification in Firebase App Check by introducing a consume parameter to the verify_token function. When enabled, the service calls the App Check backend to mark the token as consumed, providing replay protection, and returns an already_consumed flag. Corresponding unit tests have also been added. The review feedback suggests improving error handling by using _utils.handle_platform_error_from_requests instead of _utils.handle_requests_error to propagate detailed GCP error messages to developers.
jonathanedey
approved these changes
Aug 20, 2026
|
|
||
| verified_claims['app_id'] = verified_claims.get('sub') | ||
|
|
||
| if consume: |
Contributor
There was a problem hiding this comment.
Let's validate consume is a bool here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for App Check one-time token verification for replay protection by adding an optional
consumeparameter toapp_check.verify_token(). The returned claims dictionary will contain analready_consumedboolean key indicating whether the token was previously consumed.