CLI
Authentication
How the CLI authenticates with Fawran
CLI Authentication
The Fawran CLI uses a secure, browser-based authentication flow to link your terminal session with your Fawran account.
How it works
- Initiate: When you run
npx @copto/fawran-cli connect, the CLI generates a unique session token. - Browser Flow: A browser window opens automatically, asking you to sign in to your Fawran dashboard.
- Approval: Once signed in, you'll see a request to authorize the CLI.
- Completion: After approval, the CLI receives two environment-scoped keys — one sandbox (
fawran_sk_test_…) and one live (fawran_sk_live_…) — and stores them locally. Commands pick the key that matches--mode.
Credentials Storage
The CLI stores credentials in ~/.fawran/config.json:
{
"keys": {
"sandbox": "fawran_sk_test_…",
"live": "fawran_sk_live_…"
},
"organizationId": "org_…"
}You can also create keys in the dashboard under Settings → API keys, choosing the environment for each.
Environment Variables
For CI/CD, where browser-based auth isn't possible, pass the key through the environment. A scoped key selects the mode on its own; set FAWRAN_MODE as well if your key is a legacy fawran_sk_… key.
export FAWRAN_SECRET_KEY=fawran_sk_test_...
npx @copto/fawran-cli sync --yes --json
# legacy key
export FAWRAN_SECRET_KEY=fawran_sk_...
export FAWRAN_MODE=sandbox
npx @copto/fawran-cli sync --yes --json| Variable | Purpose |
|---|---|
FAWRAN_SECRET_KEY | API key (--key overrides it) |
FAWRAN_MODE | sandbox or live (--mode overrides it) |
FAWRAN_API_URL | Override the API host for the selected mode (self-hosted / local) |