docs: implementation plan for PKCE + device authorization login (programmatic auth)#535
Draft
zajca wants to merge 1 commit into
Draft
docs: implementation plan for PKCE + device authorization login (programmatic auth)#535zajca wants to merge 1 commit into
zajca wants to merge 1 commit into
Conversation
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.
What
Detailed implementation plan for adding browser-based login to kbagent: PKCE authorization-code flow (default, same-machine) and device authorization flow (RFC 8628 semantics; fallback +
--device-code), issuing Keboola programmatic session credentials (kbc_at_*access token +kbc_rt_*refresh token) used against Storage/Manage APIs asAuthorization: Bearer+X-KBC-ProjectId.Static Storage-token auth remains fully supported and unchanged — both auth modes coexist so existing users and CI never have to change anything.
Document:
docs/programmatic-auth-login-plan.mdKey design points
config.jsonschema change: session metadata lives in a new siblingauth.json; session-registered projects use a sentineltoken = "kbc-session://{project_id}"in the existing field, so older CLI versions degrade to a clean per-project 401 instead of breaking (noCURRENT_CONFIG_VERSIONbump).keyring, new dependency) with a passphrase-encrypted file (AES-256-GCM + scrypt, existingcryptographydep) as fallback — per the RFC's hard requirement, no escape hatch.httpx.Auth-basedBearerAuth+ per-stackSessionTokenProvider(thread- and cross-process-safe refresh rotation with a dedicated flock; leverages the server's 30 s refresh grace window), injected via the existing client-factory default inservices/base.py— no changes at the ~150 factory call sites.kbagent auth login [--device-code] [--register-projects],auth status,auth logout.kbagent serve, SDK facade and MCP subprocess keep static tokens and fail fast on session projects (follow-up).Sources
docs/rfc/programmatic-auth/device-authorization-flow.md(v8)auth/programmatic-auth.md)Notes for reviewers
This PR is docs-only (plan review). Feedback wanted especially on: the sentinel-token backward-compat approach, access-token-in-keychain caching decision, and the PR phasing.