feat(auth): Add support for VERIFY_AND_CHANGE_EMAIL out-of-band links#950
feat(auth): Add support for VERIFY_AND_CHANGE_EMAIL out-of-band links#950jagadeesh545 wants to merge 5 commits intofirebase:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the generate_verify_and_change_email_link functionality to the Firebase Admin Python SDK, enabling the generation of links for email verification and change flows. The changes span the Auth client, user management logic, and utility constants, and are accompanied by extensive unit and integration tests. Reviewer feedback includes a suggestion to improve the robustness of the internal link generation method by validating that the new_email parameter is used exclusively with the appropriate action type, as well as a request for PEP 8 compliant formatting in the test suite.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@jagadeesh545 Thank you for your contribution! We will review this and follow up on the process for adding a new feature. I noticed that an API key was exposed in the PR description (which I have now redacted). If this API key doesn't have restrictions or is attached to other Google services, please revoke it to prevent unauthorized access. |
|
Thank you @lahirumaramba. The API key is for a dummy test project and I deleted it now. |
Discussion
Fixes #949
This pull request introduces the ability to generate out-of-band (OOB) email action links for the
VERIFY_AND_CHANGE_EMAILflow, mirroring the Node.js SDK feature. This enables a secure "change email" flow where the verification link is sent to the current address, protecting accounts from unauthorized email changes during hijacked sessions.Testing
tests/test_user_mgt.pyandtests/test_tenant_mgt.pyto verify the request payload mapsnew_emailcorrectly and validates required parameters.integration/test_auth.pyandintegration/test_tenant_mgt.pyto ensure end-to-end functionality against a real Firebase project.API Changes
'VERIFY_AND_CHANGE_EMAIL'toVALID_EMAIL_ACTION_TYPES.generate_verify_and_change_email_link(email, new_email, action_code_settings=None, app=None)to the publicauthmodule.Clientinstance.UserManager.generate_email_action_linkto acceptnew_email.Context Sources Used:
Manual Testing