Skip to content

Commit de3ee67

Browse files
committed
fix(auth): Fixed auth error code parsing
1 parent 5e75250 commit de3ee67

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

firebase_admin/_auth_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def _parse_error_body(response):
479479
separator = code.find(':')
480480
if separator != -1:
481481
custom_message = code[separator + 1:].strip()
482-
code = code[:separator]
482+
code = code[:separator].strip()
483483

484484
return code, custom_message
485485

integration/test_auth.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,19 @@ def test_email_sign_in_with_settings(new_user_email_unverified, api_key):
724724
assert id_token is not None and len(id_token) > 0
725725
assert auth.get_user(new_user_email_unverified.uid).email_verified
726726

727+
def test_auth_error_parse(new_user_email_unverified):
728+
action_code_settings = auth.ActionCodeSettings(
729+
ACTION_LINK_CONTINUE_URL, handle_code_in_app=True, link_domain="cool.link")
730+
with pytest.raises(auth.InvalidHostingLinkDomainError) as excinfo:
731+
auth.generate_sign_in_with_email_link(new_user_email_unverified.email,
732+
action_code_settings=action_code_settings)
733+
assert str(excinfo.value) == ('The provided hosting link domain is not configured in Firebase '
734+
'Hosting or is not owned by the current project '
735+
'(INVALID_HOSTING_LINK_DOMAIN). The provided hosting link '
736+
'domain is not configured in Firebase Hosting or is not owned '
737+
'by the current project. This cannot be a default hosting domain '
738+
'(web.app or firebaseapp.com).')
739+
727740

728741
@pytest.fixture(scope='module')
729742
def oidc_provider():

0 commit comments

Comments
 (0)