CLI Auth
Stop rebuilding login for every CLI.
Beltline ships the auth foundation internal CLIs need: browser login, device flow fallback, secure credential storage, automatic token refresh, and named profiles.
Auth should be the first command users trust, not the first subsystem the team regrets.
CLI auth is easy in the happy path and painful everywhere else.
Local browser login works until someone is on SSH, Codespaces, WSL, CI, or a locked-down workstation. Then the CLI needs device flow, refresh tokens, keychain storage, fallback storage, profile switching, and helpful errors when any of it breaks.
Most teams discover this after they have already shipped a PKCE-only login that breaks for half their users.
Before and after Beltline
| Before | After Beltline |
|--------|----------------|
| One-off OAuth implementation per CLI | Browser and device flow, auto-detected |
| Browser-only login | Works on SSH, Codespaces, and headless boxes |
| Tokens copied into plain config files | OS keychain storage with encrypted fallback |
| No account switching | Named profiles with --profile |
| Refresh logic left to each team | Handled by the generated runtime |
| Confusing SSH experience | Device flow falls back automatically |
Add auth in one command
beltline auth init oidc --provider okta
Generated CLI:
acme auth login
acme auth login --device
acme auth status
acme profile use staging
acme auth logout
Output:
email maya@acme.com
profile staging
org Acme Platform
expires in 47 minutes
storage macOS Keychain
The same acme auth status --json returns a stable JSON envelope that scripts and CI can rely on — and it never includes the token itself.
What Beltline handles for you
Browser login for local machines PKCE loopback flow opens the browser, waits for the callback, and stores the token securely. Works for any OIDC provider.
Device flow for SSH and headless environments
Detects the absence of a browser and falls back to device flow automatically — the same pattern used by aws sso login and gh auth login.
Profiles for staging, prod, and multiple accounts
Named profiles work the way you would expect from aws or kubectl. Switch with --profile or ACME_PROFILE.
Credential storage designed for real developer machines Keychain on macOS, Credential Manager on Windows, libsecret on Linux. Encrypted file fallback for headless environments. The team never touches this code.
Auth context reused by CLI, MCP, and automation adapters Auth requirements are part of the shared command definition. The same login session powers the CLI, the MCP server, and any generated automation adapters.
Frequently asked questions
Does this support SSO? Yes. Beltline is designed around OIDC company-login patterns. Okta, Auth0, Entra ID, WorkOS, and any custom OIDC provider work with the same auth block.
Can users have multiple profiles? Yes. Each profile carries its own token, base URL, and overrides. Create as many as the team needs — staging, production, multiple orgs.
Can agents reuse the same auth context? Yes. Auth requirements live in the shared command definition, so the same context works for CLI commands, MCP tools, and automation adapters.
Does device flow work in Codespaces?
Yes. Beltline detects SSH_CLIENT, the absence of xdg-open, and headless Linux, then picks device flow automatically.