From fd2abb1d45fdb9f09219c9907f0f876905447c0b Mon Sep 17 00:00:00 2001 From: jackred8 <31056827+jackred8@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:11:08 +0800 Subject: [PATCH] #336 use the with_subject method If you have delegated domain-wide access to the service account and you want to impersonate a user account, use the with_subject method of an existing ServiceAccountCredentials object. --- gmail/snippet/settings snippets/update_signature.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gmail/snippet/settings snippets/update_signature.py b/gmail/snippet/settings snippets/update_signature.py index bfa93c37..5df5567a 100644 --- a/gmail/snippet/settings snippets/update_signature.py +++ b/gmail/snippet/settings snippets/update_signature.py @@ -30,7 +30,8 @@ def update_signature(): for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() - + # If you want to use service account to impersonate a user account + # creds = creds.with_subject('user@yourdomain.com') try: # create gmail api client service = build('gmail', 'v1', credentials=creds)