Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 1187bda The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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. |
The Console hands the OAuth client over as a downloadable document, so users paste it into the `gws auth setup` prompts. save_client_config stored those strings verbatim, producing a client_secret.json whose client_id and client_secret each contained the whole document; every later login then failed with `401 invalid_client`. Extract the pair when the value parses as a Console document (installed or web scope) and keep plain values exactly as given. Reported in googleworkspace#947.
2dc40c8 to
1187bda
Compare
|
/gemini review |
|
Friendly ping for a maintainer look when someone has a moment. State of this PR: CLA signed, changeset included, What it fixes (#947): the Cloud Console hands the OAuth client over as a downloadable Happy to change the approach if you would rather validate at read time instead of write time, or to add a migration for already-saved broken files. |
|
Hi @jpoehnelt! |
The Console hands the OAuth client over as a downloadable document, so users paste it into the
gws auth setupprompts.save_client_configstored those strings verbatim, producing aclient_secret.jsonwhoseclient_idandclient_secreteach contained the whole document; every later login then failed with401 invalid_client.This extracts the pair when a pasted value parses as a Console document (
installedorwebscope) and keeps plain values exactly as given. Reported in #947.What changed
crates/google-workspace-cli/src/oauth_config.rs—extract_client_credentialspullsclient_id/client_secretout of a pasted document;save_client_configapplies it to both prompts. Input that is not a Console document is stored unchanged, so credentials pasted in plain form behave exactly as before..changeset/auth-setup-pasted-client-json.md— patch changeset.No new command is added, so
--dry-runoutput does not apply here.Testing
cargo test— 796 passed, 0 failed (82 + 714 across the two crate suites).installeddocument,webdocument, non-document input left untouched,save_client_configexpanding a pasted document,save_client_configkeeping plain credentials.cargo fmt --all --check— clean.cargo clippy --workspace -- -D warnings— the two lints it reports predate this PR and live in files it does not touch:src/auth.rs:140(must_usewithout a message) andsrc/helpers/script.rs:173(collapsibleifinsidematch), both with rustc 1.99.1. This PR introduces no clippy diagnostics inoauth_config.rs.Checklist
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings (only the two pre-existing lints above remain, in untouched files).