Authentication
The CLI uses a device-code style browser approval flow. The terminal asks the API to create a device authorization, then a signed-in browser approves that user code.Login
Device login flow
The API only accepts the fixedselltraces-cli client id for CLI device login. Polling returns:
| State | API response |
|---|---|
| Pending approval | 202 with { ok: true, status: "pending" } |
| Approved | 200 with { ok: true, status: "approved", token, userId } |
| Expired | 410 |
| Already consumed | 409 |
| Invalid code | 400 |
Machine token storage
After approval, the CLI writes the token to:getRequestUserId() path, which accepts legacy machine bearer tokens and Better Auth bearer sessions before falling back to browser session cookies.
Logout
Local development auth test
Run the web app with real Better Auth enabled:selltraces shim defaults to http://localhost:3000. The published
CLI defaults to https://selltraces.com; use --api or SELLTRACES_API_URL
only when intentionally targeting another origin.