Allow `gws auth login` to work with OAuth clients that don't register `userinfo.profile`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- rust
- Ambito
- authentication, cli
Direzione di ricerca
Start in crates/google-workspace-cli/src/auth_commands.rs at handle_login_inner, and trace how OAuth authorization errors are handled. Verify the flow with a client that lacks userinfo.profile, such as the gcloud public client. Done means login succeeds or gives the documented workaround, while warning that the profile scope was omitted and preserving the existing email lookup behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- gws version: 0.22.5 (built from
mainat commita3768d0) - OS: macOS 25.4.0 (also reproduces on Linux)
- gcloud SDK installed and authenticated
What I'm trying to do
Use the gcloud SDK's well-known public Desktop OAuth client (32555940559.apps.googleusercontent.com) as gws's OAuth client, so I don't have to create a separate GCP project + OAuth client just to try gws.
export GOOGLE_WORKSPACE_CLI_CLIENT_ID=32555940559.apps.googleusercontent.com
export GOOGLE_WORKSPACE_CLI_CLIENT_SECRET=ZmssLNjJy2998hD4CTg2ejr2 # public, ships in gcloud SDK
gws auth login --readonly -s drive
What happens
OAuth flow fails with:
error: restricted_client
error_description: The OAuth client was disabled.
Login never completes; no credentials are saved.
Why
handle_login_inner at crates/google-workspace-cli/src/auth_commands.rs (around line 600) unconditionally appends three identity scopes to every login request:
let identity_scopes = [
"openid",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile",
];
https://www.googleapis.com/auth/userinfo.profile is not registered on gcloud's public Desktop OAuth client (verified by inspecting ~/.config/gcloud/credentials.db — the scope list there does not include userinfo.profile). Google's OAuth endpoint rejects the whole request with restricted_client.
The same applies to gcloud's ADC client (764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com).
Expected behaviour
One of:
- (a) gws detects that the requested OAuth client cannot grant
userinfo.profileand gracefully drops it (with a warning), letting login succeed. - (b) Login is attempted; on
restricted_client, gws retries without the offending identity scope and warns the user. - (c) Documentation explicitly says "you must register your own OAuth client; gcloud's public client is unsupported."
Today the failure mode is opaque — no hint that userinfo.profile is the offending scope, no suggested workaround.
Workaround I'm using locally
Removed userinfo.profile from the forced identity-scope list. Login succeeds; fetch_userinfo_email still works (only userinfo.email is needed for the email lookup); only the People-API display-name fallback path in Gmail send-as is affected.
Possible fixes (in order of robustness)
- Try-then-fallback — request profile by default; on
restricted_clientretry without it. No hardcoded client_id list. Self-healing if Google ever changes which scopes a client supports. - Auto-detect known restricted clients — keep a small list of gcloud's public client_ids and skip
userinfo.profilefor them. Brittle if Google rotates client_ids, but simple. - Document only — recommend
gws auth setupfor a dedicated client; document why gcloud's public client doesn't work.
Happy to send a PR for whichever direction you'd like. I have a working local patch implementing option 2 with auto-detect; option 1 would take a bit more work but is cleaner long-term.
Related
- The
userinfo.profilescope was added to identity scopes as a fallback for People API display-name lookup in Gmail send-as. Dropping it doesn't break the primary login flow, only that secondary feature when the user has a Workspace account without a configured display name.
- Lingua principale
- Rust
- Stelle
- 31.1k
- Fork
- 1.8k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di googleworkspace/cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
googleworkspace/cli#921 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
googleworkspace/cli#920 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleworkspace/cli#914 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
googleworkspace/cli#882 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleworkspace/cli#858 ·
Tutte le issue di googleworkspace/cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug team:backend track:services-maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cowprotocol/services#4950 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
gitbutlerapp/gitbutler#15998 · 1 commento ·
-
bug triage:deciding
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
open-telemetry/otel-arrow#4132 ·