Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node)

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

@lahirumaramba 已经在做这个了。

开始于 2026年5月5日。

评估

这个 Issue 还没有评估数据。

描述

api: auth

Is your feature request related to a problem? Please describe.

The Identity Toolkit accounts:sendOobCode endpoint supports a VERIFY_AND_CHANGE_EMAIL request type that generates an OOB link which, when followed, both verifies the new address and updates the user's email. This is the recommended way to implement a secure "change email" flow — the verification link is sent to the current address so the flow isn't vulnerable to a stolen session setting a new email without the original owner's knowledge.

The Python Admin SDK cannot generate these links today. firebase_admin/_auth_utils.py declares:

VALID_EMAIL_ACTION_TYPES = set(['VERIFY_EMAIL', 'EMAIL_SIGNIN', 'PASSWORD_RESET'])

validate_action_type() rejects 'VERIFY_AND_CHANGE_EMAIL' before the request is made, and there is no new_email parameter on generate_email_action_link to carry the target address.

Describe the solution you'd like

Mirror the API added to firebase-admin-node in firebase/firebase-admin-node#1633 (merged April 2022):

  1. Add 'VERIFY_AND_CHANGE_EMAIL' to VALID_EMAIL_ACTION_TYPES.
  2. Add an optional new_email: str | None = None parameter to generate_email_action_link (and the corresponding Client / auth module methods), required when action_type == 'VERIFY_AND_CHANGE_EMAIL'.
  3. Include newEmail in the accounts:sendOobCode payload when set.

For reference, the Node signature is:

generateEmailActionLink(requestType, email, actionCodeSettings?, newEmail?)

Describe alternatives you've considered

Calling accounts:sendOobCode directly through Client._user_manager._make_request(...) with {"requestType": "VERIFY_AND_CHANGE_EMAIL", "email": ..., "newEmail": ..., "returnOobLink": True, ...}, reusing firebase_admin._user_mgt.encode_action_code_settings for ActionCodeSettings serialization. This works but depends on SDK internals (private _user_manager, private _make_request, private encode_action_code_settings) and bypasses the SDK's validation and error mapping.

Additional context

  • Node SDK PR adding the same feature: firebase/firebase-admin-node#1633
  • The Identity Toolkit requestType enum already includes VERIFY_AND_CHANGE_EMAIL; the REST surface is unchanged.
  • Verified against firebase-admin 7.4.0.
主要语言
Python
星标
1.2k
派生
359
平均合并
3 天 9 小时
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  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 摘要。