Skip to Content
Authentication

Authentication

Top-level auth commands

BASH
kalam login --instance prod --url https://db.example.com --user root --passwordkalam login --instance prod --url https://db.example.com --oidckalam login --instance prod --url https://db.example.com --oidc --no-browserkalam whoami --instance prodkalam logout --instance prodkalam token create --name ci-prod --instance prod
CommandBehavior
kalam loginSaves access and refresh tokens for --instance unless --no-save
kalam whoamiCalls /v1/api/auth/me with resolved credentials
kalam logoutDeletes credentials for one instance; --all clears every stored instance
kalam token createCreates a service user and prints access/refresh tokens for automation

When kalam login succeeds in an interactive terminal, the CLI drops into the SQL shell. With non-interactive stdin/stdout, login exits after saving credentials.

Connection options

OptionDescription
-u, --url <URL>Full server URL or bare host. Loopback defaults to http://; other bare hosts default to https://.
-H, --host <HOST>Host-only alternative; combines with --port.
-p, --port <PORT>Port with --host (default 3000).
--token <JWT>JWT auth token.
--user <USER>User/password login identifier.
--password [PASS]Basic auth password; prompts when omitted in interactive mode.
--instance <NAME>Credential profile name (default local).

URL resolution order:

  1. Normalized --url if set (rejects embedded credentials, query params, fragments)
  2. http://<host>:<port> when --host is set
  3. Stored credentials URL for the selected --instance
  4. Fallback http://localhost:2900

Bare --url inputs like localhost:2900 default to http://; hosts like kalam.masky.app default to https://.

Named instances

Use separate profiles for dev, staging, and prod:

BASH
kalam login --instance dev --url http://127.0.0.1:2900 --user admin --passwordkalam login --instance staging --url https://staging-db.example.com --user admin --passwordkalam login --instance prod --url https://db.example.com --user admin --password kalam whoami --instance prod

OIDC login modes

KalamDB exposes one configured external OIDC provider.

Browser login with PKCE

BASH
kalam login --instance prod --url https://db.example.com --oidc

Opens the provider login page, listens on http://127.0.0.1:8787/callback, and exchanges the code through KalamDB.

Direct device login

BASH
kalam login --instance prod --url https://db.example.com --oidc --no-browser

For providers with a device authorization endpoint when you do not want a local browser callback.

Brokered device login

BASH
kalam login --instance prod --url https://db.example.com --oidc --no-browser --brokered

When the CLI host can reach KalamDB but not the OIDC provider directly. --brokered requires --no-browser.

kalam login --no-save ... skips writing credentials to disk.

Credential flags (scripting)

OptionDescription
--list-instancesList stored credential instances.
--show-credentialsShow stored credentials for --instance.
--update-credentialsLogin and refresh JWT/refresh token for --instance.
--delete-credentialsDelete credentials for --instance.
--save-credentialsSave credentials after successful user/password login.
BASH
kalam --list-instanceskalam --show-credentials --instance devkalam --update-credentials --instance dev --url http://localhost:2900 --user adminkalam --delete-credentials --instance dev

Interactive equivalents: \show-credentials, \update-credentials, \delete-credentials.

Project workflow (kalam init / kalam dev)

kalam init writes .env with KALAM_PROFILE=kalam-dev (pattern: kalam-<env> from [project].default_env). Workflow commands load that profile from ~/.kalam/ — not from kalam.toml.

ScenarioWhat happens
Local kalam dev (new server)After the server is healthy, the CLI logs in as root using kalam/server/server.toml (auth.root_password) or mypass on loopback, then saves JWT credentials for kalam-dev
Local kalam dev (server already running)Precheck verifies saved credentials for KALAM_PROFILE
Remote kalam dev (auto_start_db = false)Precheck requires valid saved credentials — run kalam login --instance kalam-dev (or your env profile) first

Override the profile per shell with KALAM_PROFILE in .env or the environment.

Last updated on