Authenticate
Log in to lomi.. CLI with the browser device flow, manage profiles, and use tokens in CI.
Most CLI commands that call lomi. API require authentication. The CLI uses a device authorization flow (OAuth 2.0 device grant), you authorize in the browser, and the CLI stores a token locally.
Usage
lomi loginOptions
| Flag | Description |
|---|---|
--no-browser | Print the verification URL instead of opening the browser |
--profile <name> | Save the token under a named profile (e.g. sandbox) |
Example: sandbox profile
lomi login --profile sandbox
lomi switch sandboxHow it works
Device authorization starts
The CLI calls the Supabase cli-auth edge function and receives:
- A user code to enter in the browser
- A verification URL (dashboard device-verify page)
You authorize in the browser
Press Enter to open the browser (or visit the URL manually with --no-browser). Log in to your lomi. account and approve the CLI.
CLI polls for completion
While you authorize, the CLI polls the auth service. On success it receives an API key used as the CLI token.
Token is saved globally
The token is stored in your global config file:
| Platform | Config path |
|---|---|
| macOS | ~/Library/Application Support/lomi/config.json |
| Linux | ~/.config/lomi/config.json |
Override the directory with LOMI_CONFIG_DIR.
Not the same as LOMI_SECRET_KEY
The CLI token from lomi login authenticates CLI commands. Your application's secret API key (LOMI_SECRET_KEY in .env) is configured separately via lomi init.
Check authentication
lomi whoami # current profile
lomi status # token + API connectivitylomi status verifies the stored token against GET /accounts/balance.
Profiles
Use named profiles to separate sandbox and production CLI sessions:
lomi login --profile sandbox
lomi login --profile production
lomi list-profiles
lomi switch sandbox
lomi logout --profile sandboxLog out
lomi logout
lomi logout --profile sandboxClears the CLI token for the given profile from config.json.
CI and headless environments
In non-interactive environments, set a token explicitly:
export LOMI_ACCESS_TOKEN=your_cli_token
lomi statusYou can also pass --no-browser when running lomi login in a terminal where you can open the URL on another device.
For headless project setup:
lomi init --yes \
--environment sandbox \
--language ts \
--api-key lomi_sk_test_xxx \
--skip-package-installTroubleshooting
| Issue | Fix |
|---|---|
| Browser doesn't open | Copy the verification URL from the terminal |
| Code expired | Run lomi login again for a fresh user code |
Not authenticated | Run lomi login or set LOMI_ACCESS_TOKEN |
| Wrong environment | Use --profile + lomi switch, or -a https://sandbox.api.lomi.africa |