`get_user_by_email` can silently return wrong result when "allow multiple accounts with the same email address" is set

未关闭
#843 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@Xiaoshouzi-gh 已经在做这个了。

开始于 2025年1月14日。

评估

这个 Issue 还没有评估数据。

描述

api: auth
Describe your environment
  • Operating System version: macOS 15.2
  • Firebase SDK version: 6.6.0
  • Firebase Product: auth
  • Python version: 3.12
  • Pip version: uv 0.5.11
Describe the problem

I'm worried that the get_user_by_email function misleadingly silently skips some results.

It's typed as returning a single user record given an email address:

https://github.com/firebase/firebase-admin-python/blob/8ba819a4175e758576f1a7cccc131c1b66d6417a/firebase_admin/_auth_client.py#L179-L194

However, it is possible to configure Firebase to allow multiple accounts with the same email address: https://support.google.com/firebase/answer/9134820

It looks like the implementation takes just the first user record if more than one matches the provided email:

https://github.com/firebase/firebase-admin-python/blob/8ba819a4175e758576f1a7cccc131c1b66d6417a/firebase_admin/_user_mgt.py#L583-L602

I'd suggest replacing it with a get_users_by_email that returns a collections of records, to avoid misleading programmers unfamiliar with the "allow multiple accounts with the same email address" option.

主要语言
Python
星标
1.2k
派生
359
平均合并
5 天 6 分钟
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/firebase-admin-python 的其他 Issue

查看 firebase/firebase-admin-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。