oxidecomputer / third-party-api-clients

A place for keeping all our generated third party API clients.
https://docs.rs/octorust
MIT License
132 stars 55 forks source link

Google Drive: Changing client subject #87

Open r614 opened 10 months ago

r614 commented 10 months ago

Hey folks! I'm using a service account as auth for a backend service. As a part of this, I need to assume the identity of another user. The Python equivalent of this w/ the official sdk is:

# Load Google Drive service account credentials
sa_json = json.loads(os.getenv("GOOGLE_SERVICE_ACCOUNT_JSON"))
_c = service_account.Credentials.from_service_account_info(
    sa_json,
    scopes=["https://www.googleapis.com/auth/drive"],
)
google_creds = _c.with_subject("another_email@service.com")

Wondering if you guys have thoughts on achieving something similar w/ the library