Skip to content

fix(identity): add auth_type and resource to AuthBlockingEvent - #317

Open
IzaakGough wants to merge 3 commits into
mainfrom
fix/auth-blocking-event-auth-type-resource
Open

IzaakGough wants to merge 3 commits into
mainfrom
fix/auth-blocking-event-auth-type-resource

Conversation

@IzaakGough

@IzaakGough IzaakGough commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #316.

AuthBlockingEvent had no auth_type or resource, so code written from the blocking functions doc raised AttributeError.

This adds both, built from the blocking token the same way the Node SDK does.

  • Project ID comes from the default Firebase app, the same one the token verifier checks against.

Tested with unit tests and by running the issue's handler locally, with and without a tenant. Not tested on a deployed function.

Derived from the blocking token the same way as the Node SDK, so code
written from the blocking functions docs works on Python.

@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 introduces AuthType and AuthBlockingResource to the identity functions, adding auth_type and resource fields to AuthBlockingEvent along with corresponding unit tests. However, there are critical issues regarding unauthenticated requests: token_data["user_record"] is accessed unconditionally which will raise a KeyError when no user record is present, and the data field in AuthBlockingEvent needs to be made optional to support these unauthenticated events properly.

Comment thread src/firebase_functions/private/_identity_fn.py
Comment thread src/firebase_functions/identity_fn.py
@IzaakGough
IzaakGough marked this pull request as ready for review October 12, 2026 13:36
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.

identity_fn.AuthBlockingEvent is still missing auth_type and resource

2 participants