Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

identity_fn.AuthBlockingEvent is still missing auth_type and resource

Aberta Para iniciantes
#316 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
84/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
api

Direção de pesquisa

Comece no dataclass AuthBlockingEvent em src/firebase_functions/identity_fn.py, ao lado dos campos adicionados pela #231 (event_type, email_type, sms_type). Derive as duas novas propriedades seguindo a lógica de parseAuthEventContext vinculada no Node: auth_type a partir da presença de user_record, resource a partir de tenant_id e do id do projeto. Pronto significa que o snippet de repro não lança mais AttributeError e que a suíte de testes existente de identity_fn passa, com cobertura tanto do caso com tenant quanto do caso sem tenant.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug
Summary

#231 added event_type, email_type, and sms_type to identity_fn.AuthBlockingEvent (thanks!). Two properties from the blocking functions doc are still missing, so code written from the doc fails on Python:

Doc property Node firebase-functions Python firebase-functions
authType authType: "USER" | "UNAUTHENTICATED" not present
resource resource: { service, name } not present
Repro
from firebase_functions import identity_fn

@identity_fn.before_user_signed_in()
def handle(event: identity_fn.AuthBlockingEvent):
    event.auth_type  # AttributeError
    event.resource   # AttributeError

Checked against the AuthBlockingEvent dataclass on main (identity_fn.py) and in 0.6.0.

Where the values come from

The Node SDK derives both from the blocking token rather than reading dedicated claims, so Python can do the same. From parseAuthEventContext:

  • authType is "USER" when the token has a user_record, otherwise "UNAUTHENTICATED".
  • resource.service is identitytoolkit.googleapis.com, and resource.name is projects/<project-id>/tenants/<tenant_id> when the token has a tenant_id, otherwise projects/<project-id>.
Context

First reported in firebase/functions-samples#1129 and in #224, which #231 partly addressed. I'm closing the samples issue in favor of this one, since the fix belongs in the SDK. Until then, the tenant is available as event.data.tenant_id.

Linguagem predominante
Python
Estrelas
167
Forks
36
Merge médio
4d 3h
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de firebase/firebase-functions-python

Todas as issues de firebase/firebase-functions-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.