fix(auth): restrict Keep service account to Keep API calls only#414
Merged
steipete merged 1 commit intoopenclaw:mainfrom Mar 7, 2026
Merged
Conversation
When a Keep-specific service account file (keep-sa-*.json) exists, tokenSourceForServiceAccountScopes falls back to it for all API calls, not just Keep. This causes 401 errors on Calendar, Gmail, Drive, and other services that should use OAuth. Only use keep-sa and legacy Keep SA files when serviceLabel is "keep", allowing other services to fall through to OAuth authentication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
steipete
added a commit
that referenced
this pull request
Mar 7, 2026
Collaborator
|
Landed via squash merge onto main, then applied a follow-up fixup on main to add the regression tests and changelog entry that were validated before merge.
Thanks @jgwesterlund! |
Collaborator
|
Follow-up landed on main after the merge race: Thanks @jgwesterlund! |
steipete
added a commit
that referenced
this pull request
Mar 7, 2026
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
…claw#414) When a Keep-specific service account file (keep-sa-*.json) exists, tokenSourceForServiceAccountScopes falls back to it for all API calls, not just Keep. This causes 401 errors on Calendar, Gmail, Drive, and other services that should use OAuth. Only use keep-sa and legacy Keep SA files when serviceLabel is "keep", allowing other services to fall through to OAuth authentication. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
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
keep-sa-*.json) exists (no genericsa-*.json),tokenSourceForServiceAccountScopesfalls back to the Keep SA for all API calls, causing 401 errors on Calendar, Gmail, Drive, and other services that should use OAuthserviceLabelcheck so Keep SA files are only used whenserviceLabel == "keep", allowing other services to correctly fall through to OAuth authenticationReproduction
gog auth add user@domain.comgog auth keep --key sa.json user@domain.comgog calendar events primary --today→ 401 Unauthorized (uses Keep SA instead of OAuth)Test plan
go test ./internal/googleapi/...passes🤖 Generated with Claude Code