fix(auth): restrict Keep service account to Keep API calls only#414
Open
jgwesterlund wants to merge 1 commit intosteipete:mainfrom
Open
fix(auth): restrict Keep service account to Keep API calls only#414jgwesterlund wants to merge 1 commit intosteipete:mainfrom
jgwesterlund wants to merge 1 commit intosteipete:mainfrom
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>
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