Persist OAuth project scope - #216
Open
masnwilliams wants to merge 6 commits into
Open
Conversation
hiroTamada
approved these changes
Aug 6, 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
kernel authtests
go test ./...go vet ./...go build ./...dependency
Pairs with kernel/kernel-mcp-server#138. The fields are optional, so this remains compatible with the currently deployed OAuth server.
Note
Medium Risk
Touches credential storage and token refresh for all OAuth users; scope mistakes could limit API access until re-login, but fields are optional and backward compatible with older auth servers.
Overview
Adds organization-wide vs project-scoped OAuth to stored credentials:
access_scopeandproject_idare saved onTokenStorage, filled from OAuth callbackstateand overridden by the token endpoint on code exchange and refresh.Login and refresh behavior: Missing scope defaults to organization-wide; org scope clears
project_id. Legacy refresh responses without scope fields keep organization-wide access.kernel authprints the active scope (project ID or organization-wide).README updates describe choosing scope at login, scope retention until re-login, and that project-scoped tokens cannot use
--projectto switch projects.Reviewed by Cursor Bugbot for commit e7aa285. Bugbot is set up for automated code reviews on this repo. Configure here.