feat: personal-access-token auth (AGENTAGE_TOKEN / --token)#266
Merged
Conversation
Add AGENTAGE_TOKEN env var and a --token flag so CI / headless machines can authenticate with a dashboard-minted PAT (aga_...) instead of the interactive OAuth/DCR sign-in. A PAT is an oauthAccessToken row, so it rides through the existing authed request paths as the bearer; it carries no refresh token and never attempts an OAuth refresh. Precedence is flag > env > stored OAuth. REST provisioning (session-only) fails with a clear message naming the MCP-only limitation.
Contributor
|
🎉 PR Validation ✅ PASSED Commit: Checks:
Ready to merge! ✨ 🔗 View workflow run |
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
Adds a personal-access-token (PAT) credential path to the CLI so CI / headless machines can authenticate without the interactive OAuth/DCR browser sign-in.
AGENTAGE_TOKEN=aga_...env var (primary, CI-friendly) +--token <token>flag onstatus.Authorization: Beareron the existing authed request paths. PATs areoauthAccessTokenrows server-side, so introspection / MCP validate them identically to an OAuth access token.statuslabels PAT auth (signed in via token).Files
src/lib/auth/credentials.ts(new) -resolveAuth(precedence),patAuthState,rawPatToken,assertPatShape.src/lib/auth/api.ts-refreshOrThrowrefuses a PAT.src/lib/auth/provision.ts- PAT -> clear unauthenticated message, no network call.src/lib/fs/config.ts-AuthState.kind?: 'pat'marker (never persisted).src/commands/status/status.ts+src/lib/status/status-info.ts---tokenflag, PAT-aware status line.Tests
credentials.test.ts- precedence (flag > env > stored), shape validation, synthesized state.api.test.ts- PAT rides throughauthedGet/authedPostas the bearer; refresh refused; 401 terminal (no/tokencall).provision.test.ts- PAT -> unauthenticated, no REST call.status-info.test.ts-pat: trueflag.npm run verifygreen (499 tests), coverage gate green.Manual smoke (prod, fake token)
Proves the PAT header path executes against
agentage.ioand a real token would authenticate.Not in scope
auth.json, not the foreground env).