optixlog login
Authenticate with an API key, verify it against the server or a fixture, and persist the credential to ~/.optixlog/credentials.toml.
optixlog login authenticates you with an API key, verifies it by calling whoami, and saves the credential under a named profile in ~/.optixlog/credentials.toml. Run it once per machine (or once per profile). Any value not supplied as a flag or environment variable is prompted for interactively.
Synopsis
optixlog login [OPTIONS]Flags
Prop
Type
Resolution precedence
Base URL
--base-url flag → OPTIXLOG_BASE_URL env → stored profile → prompt (default https://optixlog.leidos.com)With --no-input, the stored or default value is used without prompting.
API key
OPTIXLOG_API_KEY env → --api-key flag → prompt (hidden input)If no key is found and --no-input is set, the command raises a CredentialsError and exits 1.
What login saves
On success, login writes (or overwrites) the named profile in ~/.optixlog/credentials.toml with:
| Field | Source |
|---|---|
api_base_url | Resolved base URL |
api_key | Resolved API key |
key_type | Cached from the server's whoami response |
organization_id | Cached from the server's whoami response |
user_email | Cached from the server's whoami response |
The file is written with mode 0600 and its parent directory ~/.optixlog/ with 0700.
Re-running login for a profile refreshes that profile in place. Other profiles in the file are not affected.
Success message
Logged in as you@org.com (service key). Saved globally to ~/.optixlog/credentials.toml [profile: default] — works from any directory.The <who> field is the user_email if available, otherwise the organization_id, otherwise unknown identity. Key type is shown as user (when the server reports human), service, or the raw value returned.
Example output (interactive)
$ optixlog login
API base URL [https://optixlog.leidos.com]: https://optixlog.leidos.com
API key (sk-opt-...):
Logged in as founder@optixlog.com (service key). Saved globally to ~/.optixlog/credentials.toml [profile: default] — works from any directory.Usage examples
optixlog loginPrompts for the base URL (shows the stored or default value) and the API key (hidden input).
optixlog login \
--api-key "$OPTIXLOG_API_KEY" \
--base-url https://optixlog.leidos.com \
--no-inputSuitable for CI. All values come from flags or environment variables; no prompts.
optixlog login \
--fixture tests/fixtures/schema.sample.json \
--api-key sk-opt-test \
--base-url http://xValidates against a local fixture JSON instead of a live server. Useful for offline development and testing.
Using named profiles
Store separate credentials for your personal workflow and a CI service account:
# Personal key (default profile)
optixlog login --api-key sk-opt-user-abc123
# CI service-account key
optixlog login --api-key sk-opt-svc-xyz789 --profile ciUse --profile ci on any subsequent command to select the CI credential.
Errors
| Condition | Message | Exit code |
|---|---|---|
No API key supplied and --no-input set | error: an API key is required (pass --api-key, set OPTIXLOG_API_KEY, or enter it when prompted). | 1 |
| Fixture file not found | error: fixture not found: <path> | 1 |
| Invalid API key (server rejects it) | error: <server message> | 1 |
| Unreachable server | error: <network message> | 1 |
Never commit credentials
~/.optixlog/credentials.toml is secret. Only optixlog.toml is committed to version control. See Credentials.