firebase / functions-samples

Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase
https://firebase.google.com/docs/functions
Apache License 2.0
12k stars 3.83k forks source link

[DOCS] for sample: auth-blocking-functions | Cannot extract event_type #1129

Closed axelmukwena closed 4 months ago

axelmukwena commented 4 months ago

auth-blocking-functions

Given the Google Documentations here to Getting user and context information, some fields are not available on the AuthBlockingEvent dataclass.

For example I can extract the following:

from firebase_admin import initialize_app
from firebase_functions import https_fn, identity_fn, options

initialize_app()

@identity_fn.before_user_signed_in()
def handle_user(
    event: identity_fn.AuthBlockingEvent,
) -> identity_fn.BeforeSignInResponse | None:
    email = event.data.email
    uid = event.data.uid
    event_id = event.event_id
    event_type = event.credential

However, the following does on exist on the even signature.

from firebase_admin import initialize_app
from firebase_functions import https_fn, identity_fn, options

initialize_app()

@identity_fn.before_user_signed_in()
def handle_user(
    event: identity_fn.AuthBlockingEvent,
) -> identity_fn.BeforeSignInResponse | None:
    event_type = event.event_type
    auth_type = event.auth_type
    resource = event.resource
    # etc
axelmukwena commented 4 months ago

Close and moved here https://github.com/firebase/firebase-functions-python/issues/180