-
Notifications
You must be signed in to change notification settings - Fork 0
Add auth login command using OAuth device flow #5
Copy link
Copy link
Open
Description
Summary
Implement lattice auth login using the OAuth 2.0 device flow so the CLI can access Lattice app APIs with user identity.
Details
The forkzero/auth service already provides:
- Device flow endpoints (
POST /api/v1/device/authorize,POST /api/v1/device/token) - Rust SDK with device flow support (
crates/forkzero-auth)
UX
$ lattice auth login
→ Visit https://id-dev.forkzero.com/device and enter code: ABCD-1234
→ Waiting for authorization... ✓
→ Logged in as george@forkzero.com
Implementation
- Add
lattice auth loginsubcommand - Call device/authorize to get
user_code,device_code,verification_uri - Display URL + code, optionally open browser
- Poll device/token until approved (handle
authorization_pending,slow_down,expired_token) - Cache token locally (e.g.
~/.lattice/credentials.json) with refresh token - Add
lattice auth logoutto clear cached credentials - Add
lattice auth statusto show current auth state
Dependencies
- forkzero/auth#10 —
lattice-appclient needs device_code grant type enabled
Also needed (in this repo)
- Token storage — cache access/refresh token locally, auto-refresh on expiry
- API key fallback — check
LATTICE_API_KEYenv var before requiring OAuth login (for CI/automation)
🤖 Generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels