fix: use documents scope to allow editing existing Google Docs#336
Open
levon003 wants to merge 1 commit into
Open
fix: use documents scope to allow editing existing Google Docs#336levon003 wants to merge 1 commit into
levon003 wants to merge 1 commit into
Conversation
The google-docs app requested drive.readonly + drive.file, which only permits editing documents the app itself created. Editing a pre-existing Google Doc (documents.batchUpdate) fails with 403 PERMISSION_DENIED even when the connected account has edit rights. Mirror the Sheets fix (onecli#319) and its follow-up scope tightening (onecli#323): replace the Drive scopes with resource-specific Docs scopes. - drive.readonly -> documents.readonly (read) - drive.file -> documents (read/write existing docs) Matches the current google-sheets definition and follows least privilege: the Docs app no longer requests broad read of all Drive files; Drive listing/search remains the google-drive app's responsibility. Fixes onecli#335. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary text below written by Opus 4.8, but I've carefully reviewed the text and agree with Opus that this is likely a change you want to incorporate.
Problem
The
google-docsapp requestsdrive.readonly+drive.file, which only permits editing documents the app itself created/opened. Editing a pre-existing Google Doc viadocuments.batchUpdatefails with403 PERMISSION_DENIED, even when the connected account has edit rights on the file.Fixes #335.
Fix
Mirror the Sheets fix in #319 and its follow-up scope tightening in #323 — replace the broad Drive scopes with resource-specific Docs scopes:
drive.readonly→documents.readonly(read)drive.file→documents(read/write — allows editing any existing doc)This matches the current
google-sheetsdefinition (spreadsheets.readonly+spreadsheets) and follows least privilege: the Docs app no longer requests read access to all Drive files — Drive listing/search remains thegoogle-driveapp's responsibility.Verification
pnpm --filter @onecli/api check-types✓pnpm --filter @onecli/api lint✓prettier --check✓Verified empirically against the live Docs API: the equivalent Sheets change (#319) took editing an existing spreadsheet from
403to200; Docs is the structurally identical provider.Note for existing connections
Existing
google-docsconnections must be reconnected to pick up the new scope (consent re-prompt) — same as Sheets after #319.