Quick start
Login flow
- Run
ekanos login --host <url> - The CLI prints a short code and a browser URL to stderr
- Open the URL in any browser on any device
- Approve the request
- The CLI polls and confirms when approved
login exits 4 with The login code expired before it was approved. — run ekanos login again.
Host resolution
logout, whoami, status, sources, use, publish, and upgrade resolve the host in this order:
--hostflagEKANOS_HOSTenvironment variablehostfield inekanos.json(the project’s deployment)- Sole stored host (if your credentials file holds exactly one)
ekanos.json or the sole stored login, the CLI names it on stderr.
login is special: it resolves from --host, else EKANOS_HOST, else the sole stored host — never from ekanos.json. Login is the one verb that creates credentials, and ekanos.json is committed to git; if login honored it, anyone could point your device flow at their own tenant just by editing a file.
Example: single-deployment workflow
Example: multi-deployment workflow
ekanos use and a successful ekanos publish write host to ekanos.json only when it has no host yet; an existing value is never overwritten by a one-off --host. After that, verbs in the project resolve the host from ekanos.json.
No host specified, multiple stored
Credential storage
Credentials are stored in~/.ekanos/credentials.json with mode 0600, inside a ~/.ekanos directory forced to 0700. Writes go to a temporary file that is renamed into place.
File structure
accessToken is the short-lived Ekanos JWT; auth0RefreshToken is the rotating refresh token.
A file that is not valid JSON or not a recognized credentials file is a precondition_failed error (exit 9) rather than a silent logout. It holds only credentials, so deleting it and running ekanos login again is safe.
Relocation
SetEKANOS_HOME to use a different home directory (useful in containers, CI):
$EKANOS_HOME/.ekanos/credentials.json.
Permissions
If the file or directory is group- or world-accessible, the CLI tightens the permissions and warns on stderr, for example:No token in output
Tokens are never printed — not bywhoami, not in error messages, not in --json envelopes, not at any log level.
Idempotence
Login
Runningekanos login with a session that still works verifies it against the server and exits 0 without opening a browser:
data.status is already-authenticated (versus authenticated after a fresh login). Use --force to start a fresh login regardless:
Logout
Logging out twice exits 0 both times:data is { host, cleared, revoked }; the second run reports cleared: false. --all signs out of every stored host and reports per-host revoked results.
Revocation is attempted but never blocks the local delete: try to revoke, always delete, report both.
Rotation safety
Auth0 rotates the refresh token the moment the server’s exchange succeeds, so from that instant the replacement is the only copy in existence — and/api/auth/cli-refresh can still fail afterwards. It therefore returns the rotated token on its error responses too, and the CLI persists it the moment it is seen, before surfacing any error.
Single process: rotate, then fail
- The CLI refreshes the session
- The refresh token rotates and is saved immediately
- A later step fails
- Retry the command — the saved token is used
Two processes: concurrent rotation
Two CLIs sharing one credentials file both present the same token. Auth0 honors the first; the second gets a clean exit 4 (auth_required). There is no file lock — re-run ekanos login.
Exit codes
0— Success2— No host could be resolved4— Auth required: no session, an expired one that could not be renewed, or a revoked one. Runekanos login8— Network: the host was unreachable, or the refresh rotated but could not complete. Retry; do not log in again9— Precondition: an unreadable credentials file, an invalid--hostURL, or a host without CLI login configured
Troubleshooting
Not logged in to a host
ekanos login --host <url>.
Several hosts stored and none chosen
See No host specified, multiple stored. Fix: Use--host or set EKANOS_HOST:
Revocation failed during logout
logout still exits 0 and reports revoked: false.
Fix: Nothing urgent — the token is off your machine. If the machine is compromised, ask your Ekanos operator to revoke the session.
Session expired and could not be renewed
The session for https://your-ekanos-host could not be renewed.
Fix: Re-authenticate:
Plaintext HTTP warning
http:// is allowed (local development needs it), but a non-loopback plaintext host gets this warning. Use https://.