gmail +read returns 403 quota-project error when authenticated with default scopes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #939 by @mittalpk — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- authentication, cli
Research direction
Start in the +read helper at fetch_message_metadata and trace its use of crate::client::build_client() and send_with_retry, comparing it with executor.rs and auth::get_quota_project(). Verify the reproduction commands, then confirm that +read supplies the quota project header and succeeds with default scopes without breaking the documented non-project-member case.
Written by the indexing model from the issue text.
Description
gws gmail +read fails with:
Your application is authenticating by using local Application Default Credentials.
The gmail.googleapis.com API requires a quota project, which is not set by default.
The equivalent raw command succeeds:
gws gmail users messages get --params '{"userId":"me","id":"<id>","format":"full"}'
Cause
Google identifies tokens from the Cloud SDK client (764086051850-...) as ADC and requires the x-goog-user-project header. Standard resource commands go through executor.rs, which calls auth::get_quota_project() and adds the header. The +read helper bypasses executor.rs and calls fetch_message_metadata directly via crate::client::build_client() and send_with_retry. The request goes out with .bearer_auth(token) only, no quota project header.
This gap exists because #242 moved the x-goog-user-project injection from build_client() into executor.rs. When +read was added in #526, it called build_client() directly and missed the header.
Reproduction
gws auth login # default scopes (gmail.modify)
gws gmail +read --id <any-message-id>
# -> 403 accessNotConfigured
gws gmail users messages get --params '{"userId":"me","id":"<id>","format":"full"}'
# -> succeeds
Adding gmail.readonly to the token does not help — the scope is irrelevant. The missing header is the sole cause.
Related
- #242 — moved
x-goog-user-projectfrombuild_client()toexecutor.rs - #526 — introduced
+readbypassingexecutor.rs - #729 / #827 — inverse problem where the header causes 403 for non-project-member OAuth users
Suggested fix
Add x-goog-user-project via auth::get_quota_project() in fetch_message_metadata (and other helper functions that bypass executor.rs). Same trade-off as #729 applies.
Alternatively, refactor helpers to route through executor.rs or a shared request-building function that handles auth headers consistently.
Workaround
gws gmail users messages get --params '{"userId":"me","id":"<message-id>","format":"full"}'
Environment
- gws 0.22.5, macOS (Apple Silicon)
- Auth: OAuth desktop, keyring backend
- Confirmed with both
gmail.modifyonly andgmail.modify+gmail.readonly - ADC
quota_project_idset to a project with Gmail API enabled (irrelevant —build_client()does not propagate it)
- Dominant language
- Rust
- Stars
- 32.3k
- Forks
- 2k
- Avg merge
- 16h 3m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleworkspace/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
googleworkspace/cli#984 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
googleworkspace/cli#983 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
googleworkspace/cli#958 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
googleworkspace/cli#921 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
googleworkspace/cli#920 ·
Maintainers usually reply within 1 day
All issues in googleworkspace/cli
Similar issues
-
area:cli area:security bug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
status: new topic: ga4gh-sdk type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
comp-rbac
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ClickHouse/ClickHouse#131875 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug(python): read_transaction raises TypeError on a Rewrite with rewritten indicesPossibly taken @Borg93 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lance-format/lance#11117 ·
Maintainers usually reply within 2 days