feat(auth): add device code login flow and credential management#8
Merged
feat(auth): add device code login flow and credential management#8
Conversation
4ad9656 to
ebbb91a
Compare
Rewrites `agi login` to use device code auth: - POST /v1/auth/device to initiate, opens browser automatically - Polls /v1/auth/device/token every 5s until approved - Saves API key to ~/.agi/credentials on success Also adds: - config.ts: credential file management (load/save/delete) - logout.ts: removes stored credentials - cli.ts: subcommand structure (login/logout/$0) - index.tsx: loadApiKey integration with env fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ebbb91a to
df3cd46
Compare
This was referenced Feb 10, 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
agi loginto use device code auth (no more copy-paste API key)~/.agi/credentials(0o600 permissions)agi logoutto remove stored credentialsloadApiKey()checks env vars first, then credentials fileDependencies
Test plan
agi login→ opens browser, shows confirmation code~/.agi/credentialsagi "test task"→ picks up saved key from credentials fileagi logout→ removes credentials fileAGI_API_KEY=xxx agi "test"→ env var takes precedence over file🤖 Generated with Claude Code