fix: surface auth errors instead of sending unauthenticated requests#196
fix: surface auth errors instead of sending unauthenticated requests#196tjp2021 wants to merge 1 commit intogoogleworkspace:mainfrom
Conversation
When `auth::get_token()` fails, the error was silently caught and the request sent without any Authorization header, resulting in a confusing 401 "Access denied. No credentials provided" response from Google APIs. This affected users on macOS Apple Silicon and other platforms where credential decryption can fail due to keyring issues, encryption key mismatches, or corrupted credential files. Because the error was swallowed, users saw a generic 401 with no indication that the CLI failed to load their credentials. Now the CLI prints the actual error message and troubleshooting steps, then exits with code 1 instead of sending an unauthenticated request. Fixes googleworkspace#137, googleworkspace#151, googleworkspace#156 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary
The Bug
main.rs:239-242catches allauth::get_token()errors and silently continues withAuthMethod::None:This sends the HTTP request without an Authorization header, producing:
Users see a generic Google API 401 with no indication that the CLI failed to load their local credentials. This is the root cause of #137, #151, and #156.
The Fix
Before
After
Why this matters
At least 5 open issues (#137, #151, #156, #179, #187) stem from users seeing 401 after successful login. The silent error swallowing makes this nearly impossible to debug — users assume the CLI is sending credentials when it isn't.
This doesn't fix the underlying credential decryption issues (keyring, encryption key mismatches, etc.), but it makes them visible so users can actually troubleshoot or report the real error.
Fixes #137, #151, #156
Test Plan
eprintln!+process::exitare infallible)cargo test(maintainer — I don't have Rust toolchain installed)🤖 Generated with Claude Code