You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f978dd6
Browse filesBrowse the repository at this point in the historyBrowse files
## summary
- persist authoritative organization/project scope returned by the OAuth
server
- preserve scope across automatic refresh and treat legacy credentials
as organization-wide
- show the active OAuth scope in `kernel auth`
- document organization-wide and project-scoped login behavior
## tests
- `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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes OAuth token handling and stored credential shape; behavior is
backward compatible for legacy tokens but affects how scope is enforced
for all OAuth sessions after login or refresh.
>
> **Overview**
> Adds **organization-wide vs project-scoped OAuth** to the CLI by
persisting `access_scope` and `project_id` on stored credentials.
>
> During login, the callback may carry scope in OAuth `state`; after
code exchange, **token response fields override** state for `org_id`,
`access_scope`, and `project_id`. Missing scope defaults to
organization-wide; org-wide tokens clear `project_id`. The same fields
are updated on **refresh**, with legacy tokens without scope fields
treated as organization-wide.
>
> **`kernel auth`** prints whether the session is organization-wide or
locked to a project ID. README documents choosing scope at login and
that project-scoped tokens cannot use `--project` to switch projects.
>
> Tests cover authoritative scope from token exchange, refresh
preserving project scope, and legacy refresh behavior.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c9eb41d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ The easiest way to authenticate is using OAuth:
84
84
kernel login
85
85
```
86
86
87
-
This opens your browser to complete the authentication flow. Your credentials are securely stored and automatically refreshed.
87
+
This opens your browser to complete the authentication flow. Choose organization-wide access or restrict the login to one project. Your credentials are securely stored, automatically refreshed, and retain the selected scope until you log in again.
88
88
89
89
### API Key
90
90
@@ -103,7 +103,7 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
-`--project <project-id>` - Scope requests to a project ID (or set `KERNEL_PROJECT` to a project ID)
106
+
-`--project <project-id>` - Scope requests to a project ID (or set `KERNEL_PROJECT` to a project ID). Project-scoped OAuth tokens cannot switch projects.
0 commit comments