Title: UserNotFoundError is not raised as expected. Instead, UnexpectedResponseError is raised. · Issue #813 · firebase/firebase-admin-python · GitHub
Open Graph Title: UserNotFoundError is not raised as expected. Instead, UnexpectedResponseError is raised. · Issue #813 · firebase/firebase-admin-python
X Title: UserNotFoundError is not raised as expected. Instead, UnexpectedResponseError is raised. · Issue #813 · firebase/firebase-admin-python
Description: [READ] Step 1: Are you in the right place? For issues related to the code in this repository file a GitHub issue. If the issue pertains to Cloud Firestore, report directly in the Python Firestore GitHub repo. Firestore bugs reported in t...
Open Graph Description: [READ] Step 1: Are you in the right place? For issues related to the code in this repository file a GitHub issue. If the issue pertains to Cloud Firestore, report directly in the Python Firestore G...
X Description: [READ] Step 1: Are you in the right place? For issues related to the code in this repository file a GitHub issue. If the issue pertains to Cloud Firestore, report directly in the Python Firestore G...
Opengraph URL: https://github.com/firebase/firebase-admin-python/issues/813
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"UserNotFoundError is not raised as expected. Instead, UnexpectedResponseError is raised.","articleBody":"### [READ] Step 1: Are you in the right place?\r\n\r\n * For issues related to __the code in this repository__ file a GitHub issue.\r\n * If the issue pertains to __Cloud Firestore__, report directly in the\r\n [Python Firestore](https://github.com/googleapis/python-firestore) GitHub repo. Firestore\r\n bugs reported in this repo will be closed with a reference to the Python Firestore\r\n project.\r\n * For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)\r\n with the `firebase` tag.\r\n * For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk)\r\n google group.\r\n * For help troubleshooting your application that does not fall under one\r\n of the above categories, reach out to the personalized\r\n [Firebase support channel](https://firebase.google.com/support/).\r\n\r\n### [REQUIRED] Step 2: Describe your environment\r\n\r\n * Operating System version: 14.2.1(23C71)\r\n * Firebase SDK version: 6.3.0\r\n * Firebase Product: auth\r\n * Python version:3.12.0\r\n * Pip version: 24.0\r\n\r\n### [REQUIRED] Step 3: Describe the problem\r\n\r\nWhen calling the `generate_password_reset_link`, we got errors `Failed to generate email action link.` which is raised in `_auth_utils.UnexpectedResponseError`.\r\nWe expect UserNotFoundError to be raised if the email in request is not in authentication list.\r\n\r\n#### Steps to reproduce:\r\n\r\nWhat happened? How can we make the problem occur?\r\nThis could be a description, log/console output, etc.\r\n\r\nCalling `generate_password_reset_link` with invalid email\r\n\r\n#### Relevant Code:\r\n\r\n```\r\ndef reset_password(\r\n self, request: PostResetPasswordRequest, lang: str, client: MailjetClient\r\n ):\r\n try:\r\n password_link = auth.generate_password_reset_link(request.email)\r\n except auth.UserNotFoundError:\r\n # For security reasons, we don't want to reveal whether the email exists or not\r\n logging.info(\r\n f\"Password reset request for non-existing email: {request.email}\"\r\n )\r\n return None\r\n\r\n except Exception as e:\r\n logging.error(f\"Failed to accept password reset request: {e}\")\r\n return None\r\n```\r\n\r\n```\r\ndef generate_email_action_link(self, action_type, email, action_code_settings=None):\r\n \"\"\"Fetches the email action links for types\r\n\r\n Args:\r\n action_type: String. Valid values ['VERIFY_EMAIL', 'EMAIL_SIGNIN', 'PASSWORD_RESET']\r\n email: Email of the user for which the action is performed\r\n action_code_settings: ``ActionCodeSettings`` object or dict (optional). Defines whether\r\n the link is to be handled by a mobile app and the additional state information to be\r\n passed in the deep link, etc.\r\n Returns:\r\n link_url: action url to be emailed to the user\r\n\r\n Raises:\r\n UnexpectedResponseError: If the backend server responds with an unexpected message\r\n FirebaseError: If an error occurs while generating the link\r\n ValueError: If the provided arguments are invalid\r\n \"\"\"\r\n payload = {\r\n 'requestType': _auth_utils.validate_action_type(action_type),\r\n 'email': _auth_utils.validate_email(email),\r\n 'returnOobLink': True\r\n }\r\n\r\n if action_code_settings:\r\n payload.update(encode_action_code_settings(action_code_settings))\r\n\r\n body, http_resp = self._make_request('post', '/accounts:sendOobCode', json=payload)\r\n if not body or not body.get('oobLink'):\r\n raise _auth_utils.UnexpectedResponseError(\r\n 'Failed to generate email action link.', http_response=http_resp)\r\n return body.get('oobLink')\r\n```\r\n\r\n","author":{"url":"https://github.com/evan-hitobito","@type":"Person","name":"evan-hitobito"},"datePublished":"2024-09-24T08:00:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/813/firebase-admin-python/issues/813"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:53fa33eb-99bf-e251-ae73-6efdaf4b85d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F72:CE233:1F0D4:27D26:698E94F2 |
| html-safe-nonce | d189731bcb88fc6fa3ef7abdf7f6f07278e300f73df855e14227974ac8a2ba5b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjcyOkNFMjMzOjFGMEQ0OjI3RDI2OjY5OEU5NEYyIiwidmlzaXRvcl9pZCI6IjczMTI1MTg1ODczMDE2NjM5ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4d7bfc9270166a2d7b31964729ba6e4bafe4c8a7e54f80ce4b0d53d4db909657 |
| hovercard-subject-tag | issue:2544658388 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/firebase/firebase-admin-python/813/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b807f54f9ef0926f584b7c0338ebd9af10f550ab16b2ae44c52b2f0d0fe59936/firebase/firebase-admin-python/issues/813 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b807f54f9ef0926f584b7c0338ebd9af10f550ab16b2ae44c52b2f0d0fe59936/firebase/firebase-admin-python/issues/813 |
| og:image:alt | [READ] Step 1: Are you in the right place? For issues related to the code in this repository file a GitHub issue. If the issue pertains to Cloud Firestore, report directly in the Python Firestore G... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | evan-hitobito |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/firebase/firebase-admin-python git https://github.com/firebase/firebase-admin-python.git |
| octolytics-dimension-user_id | 1335026 |
| octolytics-dimension-user_login | firebase |
| octolytics-dimension-repository_id | 84979152 |
| octolytics-dimension-repository_nwo | firebase/firebase-admin-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 84979152 |
| octolytics-dimension-repository_network_root_nwo | firebase/firebase-admin-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width