My scenario involves two service accounts, namely S1 and S2. S2 was granted domain-wide access to a Google Workspace.
I'd like to have S1 impersonate S2 (already have the "Service Account Token Creator role" on S1) and use its permissions to retrieve some information regarding Google Workspace using S2's access.
Is it possible to delegate authority to S1?
Edit: Johannes Passing solution did the trick, still feels like somewhat of a workaround, opened an issue on google-api-dotnet-client to add such a functionality.
Yes, that's possible if S2's client ID has been configured for domain-wide delegation:
iss
set to S2's email addresssub
set to the Workspace user's email addressscope
set to the scopes you whitelisted for S2's client ID and domain-wide delegationhttps://oauth2.googleapis.com/token
. As a result, you get an access token for the Workspace user.