Authentication
Binboi separates dashboard identity from CLI credentials. Users create access tokens in the dashboard, then use those tokens with `binboi login` so the CLI can authenticate securely against the backend.
Model
The dashboard is where people sign in. The CLI is where machines authenticate. Access tokens are the bridge between those two ideas.
Each token belongs to a user account and should usually represent one machine or workflow.
When the CLI presents a token, the backend validates the token and returns account information through `GET /api/v1/auth/me`.
That same validation model is reused when the agent opens a tunnel session, so login and runtime auth share one coherent story.
Dashboard
The Access Tokens page is the operator-facing source of truth for CLI credentials.
1. Open `/dashboard/access-tokens`.
2. Choose a clear token name such as `M2 MacBook`, `CI smoke runner`, or `payments-staging VM`.
3. Create the token and copy it immediately.
4. Store it locally with `binboi login --token <token>`.
5. Use the dashboard list later to review token prefix, created time, last used time, and status.
CLI
The login command validates the token first, then writes local auth state if the backend accepts it.
bash
binboi login --token <dashboard-token>
binboi whoami| Source | When it is used | Why it exists |
|---|---|---|
| `--token` flag | Highest priority | Best for copy-paste setup or explicit scripting. |
| `BINBOI_AUTH_TOKEN` | If no flag is provided | Useful in CI or non-interactive shell environments. |
| `~/.binboi/config.json` | Fallback | Best for day-to-day local development after one successful login. |
Validation
Binboi treats access tokens as secrets, not as a normal user-facing string to keep around forever.
The database stores a token prefix and a secure hash, not the raw token.
The CLI stores the raw token locally in `~/.binboi/config.json` so it can authenticate later without asking you to paste the token every time.
The backend compares the presented token against the stored hash after narrowing the search by prefix.
Security
Token safety is mostly about disciplined handling rather than fancy ceremony.
Use one token per machine or workflow so revocation stays precise.
Do not paste full tokens into screenshots, team chats, or shell history you do not control.
If a token leaks, revoke it in the dashboard immediately and create a new one.
Use `binboi whoami` before debugging tunnel failures so you can rule out auth drift early.