aboutsummaryrefslogtreecommitdiff
path: root/google/oauth2/service_account.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/oauth2/service_account.py')
-rw-r--r--google/oauth2/service_account.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/google/oauth2/service_account.py b/google/oauth2/service_account.py
index 8f18f26..ecaac03 100644
--- a/google/oauth2/service_account.py
+++ b/google/oauth2/service_account.py
@@ -399,7 +399,9 @@ class Credentials(
@_helpers.copy_docstring(credentials.Credentials)
def refresh(self, request):
- if self._jwt_credentials is not None:
+ # Since domain wide delegation doesn't work with self signed JWT. If
+ # subject exists, then we should not use self signed JWT.
+ if self._subject is None and self._jwt_credentials is not None:
self._jwt_credentials.refresh(request)
self.token = self._jwt_credentials.token
self.expiry = self._jwt_credentials.expiry