Feature request: --subject flag (or env var) for service-account impersonation on user-context APIs (Keep, Admin Directory, etc.)
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 52/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- rust
- Domaine
- api, authentication, cli
Piste de recherche
No source file or test is named. Start by locating the Rust service-account credential construction and CLI global-argument or environment-variable parsing, then reproduce the Keep notes request with domain-wide delegation. Done means a supported subject setting reaches the credentials and enables the documented user-context API flow without breaking existing service-account authentication.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Problem
Some Google Workspace APIs only work with a service account that impersonates a user via domain-wide delegation. Notable examples:
- Keep API (
keep.googleapis.com) — explicitly states user OAuth is unsupported; only service accounts work, and they need to act on behalf of a real user (since notes belong to users). - Admin Directory write operations on certain entities.
- Cloud Identity device APIs.
gws today supports two auth modes:
- User OAuth via
gws auth login - Service account via
GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json
In the SA path, there's no way to set the JWT subject (the user to impersonate). Without it, gws keep notes list returns:
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"reason": "unknown"
}
}
even when the SA has DWD authorized for https://www.googleapis.com/auth/keep on the target domain.
Reproduction
- Create an SA in GCP, enable DWD via Workspace Admin (
admin.google.com → Security → API controls → Domain-wide Delegation) with scopehttps://www.googleapis.com/auth/keep. - Export
GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json. - Run
gws keep notes list. - 403 — there is no user context attached to the request.
Proposed solution
Add one of:
- CLI flag
--subject <[email protected]>on commands (or globally ongws auth login). - Env var
GOOGLE_WORKSPACE_CLI_SUBJECTorGOOGLE_WORKSPACE_CLI_IMPERSONATE.
Internally this maps to subject=... when constructing google.oauth2.service_account.Credentials (or the equivalent Go/Rust binding depending on the implementation language).
Workaround used today
Standalone Python script using google-auth directly:
creds = service_account.Credentials.from_service_account_file(
"sa.json",
scopes=["https://www.googleapis.com/auth/keep"],
subject="[email protected]",
)
Works, but means losing all the schema-discovery / formatting / pagination ergonomics that gws ships with.
Why it matters
Without subject impersonation, gws-keep, parts of gws-admin-directory, and other DWD-only flows are effectively dead code in the skill set — the auth path can't be completed.
Happy to PR this if there's interest in the direction.
- Langage dominant
- Rust
- Étoiles
- 32.3k
- Forks
- 2k
- Merge moyen
- 16 h 3 min
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de googleworkspace/cli
-
`gws auth login` keeps the old token cache, so API calls use a token from the previous grantOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
googleworkspace/cli#984 ·
Les mainteneurs répondent en général sous 1 jour
-
auth export masks secrets by default with no warning; consumers fail later with invalid_clientOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
googleworkspace/cli#983 ·
Les mainteneurs répondent en général sous 1 jour
-
Replace gemini with agyOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
googleworkspace/cli#958 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
googleworkspace/cli#921 ·
Les mainteneurs répondent en général sous 1 jour
-
Add cli to awesome-ai-plugins?Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
googleworkspace/cli#920 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de googleworkspace/cli
Issues similaires
-
area:ui bug effort:low P2 source:agent
Difficulté 1/5 Moins d'une heure Accessibilité débutants 86/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
akitaonrails/ai-memory#2314 ·
Les mainteneurs répondent en général sous 1 jour
-
bug priority: low
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
nledford/Ladderback#809 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
ElectronicWave/Elemental#265 ·
Les mainteneurs répondent en général sous 1 jour
-
bug low-priority
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
dividebysandwich/rust-dos#1170 ·
Les mainteneurs répondent en général sous 1 jour