From 8e0558433a8a14eb92916836f7105c1e7782fec4 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 14 Jun 2021 22:13:33 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/key_management_service/transports/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/google/cloud/kms_v1/services/key_management_service/transports/base.py b/google/cloud/kms_v1/services/key_management_service/transports/base.py index 02cafa03..28edf11e 100644 --- a/google/cloud/kms_v1/services/key_management_service/transports/base.py +++ b/google/cloud/kms_v1/services/key_management_service/transports/base.py @@ -24,7 +24,7 @@ from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore +from google.oauth2 import service_account # type: ignore from google.cloud.kms_v1.types import resources from google.cloud.kms_v1.types import service @@ -119,9 +119,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) - + # If the credentials is service account credentials, then always try to use self signed JWT. - if isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + if isinstance(credentials, service_account.Credentials) and hasattr( + service_account.Credentials, "with_always_use_jwt_access" + ): credentials = credentials.with_always_use_jwt_access(True) # Save the credentials.