| Priority | Source | Where it lives |
|---|---|---|
| 1 (highest) | Command-line flag | --bearer-auth on any command |
| 2 | Environment variable | MKA1_BEARER_AUTH in your shell |
| 3 | OS keychain | macOS Keychain, GNOME Keyring / KWallet, Windows Credential Locker |
| 4 (lowest) | Config file | ~/.config/mka1/config.yaml |
1. Command-line flag
Pass credentials directly on any command:2. Environment variable
Set the token once in your shell (or CI job):mka1 auth whoami will tag the value as [env] so you can see where it came from.
3. OS keychain (recommended for workstations)
Run the interactive login once. The CLI prompts for your API key and writes it to your operating system’s secret store:- macOS: Keychain
- Linux: GNOME Keyring or KWallet (via D-Bus Secret Service)
- Windows: Credential Locker
mka1 configure is equivalent to mka1 auth login and additionally prompts for non-secret preferences such as the default server URL.
4. Config file
Non-secret defaults (such asserver-url) are stored in ~/.config/mka1/config.yaml.
When no keychain is available, the token is written there too. Protect the file with filesystem permissions if you rely on that fallback.
Inspect the active configuration
mka1 auth whoami (or the top-level alias mka1 whoami) prints every resolved setting and its source, with secret values masked:
[flag]— passed on the command line.[env]— read from anMKA1_*environment variable.[keyring]— stored byauth loginorconfigure.[config]— read from~/.config/mka1/config.yaml.[unset]— not configured.
Clear stored credentials
Remove every credential from both the keychain and the config file:unset MKA1_BEARER_AUTH.
Act on behalf of an end user
The gateway accepts an optionalX-On-Behalf-Of: <external-user-id> header so a single server-side API key can attribute traffic and enforce per-user authorization. Send it with -H on any command:
Exchange an API key for a JWT
If your downstream systems expect a bearer JWT instead of a raw API key, exchange the key at runtime:Next steps
- Commands — run your first workflows once you are authenticated.
- Debug and inspect — use
--dry-runto confirm which credentials and headers would be sent.