Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

fix(v1beta2): enable self signed jwt for grpc #191

Merged
merged 7 commits into from Sep 1, 2021
Merged
Expand Up @@ -148,15 +148,7 @@ def _get_scopes_kwargs(
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
# Documentai uses a regional host (us-documentai.googleapis.com) as the default
# so self-signed JWT cannot be used.
# Intentionally pass default scopes as user scopes so the auth library
# does not use the self-signed JWT flow.
# https://github.com/googleapis/python-documentai/issues/174
scopes_kwargs = {
"scopes": scopes or cls.AUTH_SCOPES,
"default_scopes": cls.AUTH_SCOPES,
}
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

Expand Down
9 changes: 0 additions & 9 deletions owlbot.py
Expand Up @@ -36,15 +36,6 @@
"scripts/fixup_documentai_v*", # this library was always generated with the microgenerator
]

s.replace(library / "google/cloud/documentai_v1beta2/**/base.py",
"""scopes_kwargs = \{"scopes": scopes, "default_scopes": cls\.AUTH_SCOPES\}""",
"""# Documentai uses a regional host (us-documentai.googleapis.com) as the default
# so self-signed JWT cannot be used.
# Intentionally pass default scopes as user scopes so the auth library
# does not use the self-signed JWT flow.
# https://github.com/googleapis/python-documentai/issues/174
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES, "default_scopes": cls.AUTH_SCOPES}""")

s.replace(library / "tests/**/documentai_v1beta2/*.py",
parthea marked this conversation as resolved.
Show resolved Hide resolved
"""(@requires_google_auth_gte_1_25_0
def test_document_.*?_service_base_transport_with_credentials_file.*?)scopes=None,""",
Expand Down