Sign in from a browser
cortex whoami.
From inside a session, /login does the same thing without leaving the session. The inline sign-in screen offers exactly two rows, Continue with browser and Paste an API key. There is no guest row and no exit row: pick one of the two, or press Esc.
While the CLI is waiting it shows Waiting for browser authentication…. On success it prints Signed in as .... If the attempt expires, is refused, or the credential store rejects the write, it prints Sign-in didn't complete and you can run cortex login again.
Sign in on a machine without a browser
For a server, a container, or a remote shell:Your code WXYZ-1234, along with the address to visit. Open that address on any device that does have a browser, enter the code, and approve the sign-in. The CLI picks the session up as soon as you have approved it.
Single sign-on
Unattended runs and CI
Do not use the browser flow in a pipeline. There is no browser to open and, on most runners, no credential store to write to, socortex login on its own cannot complete.
Read the secret from standard input so it never reaches your shell history or the process list:
cortex login altogether and set a variable for the job:
The CLI resolves credentials in this order:
CORTEX_AUTH_TOKEN first, then CORTEX_API_KEY, and the credential cortex login stored last. An environment variable therefore wins over a stored sign-in, which is what makes a runner predictable, and what to check first when a machine keeps acting as an account you did not expect.
Check the state, and sign out
/account (aliases /whoami and /me), /login and /logout.
Where credentials are kept
Sign-in writes to your operating system’s credential store, under the service namecortex-cli and the account name auth.
Credentials are deliberately not written to a plaintext file in your home directory, and never into the repository you are working in. The session material the CLI does keep in its own home directory carries no secrets.
If no credential store is available, a bare container or a headless runner for instance, use
CORTEX_API_KEY or CORTEX_AUTH_TOKEN rather than trying to make a store work.When sign-in does not work
Sign-in appears to succeed, but cortex whoami fails
Sign-in appears to succeed, but cortex whoami fails
The credential store did not persist the session. On Linux, check that a Secret Service provider is actually running in your session; over SSH or in a minimal desktop there often is not one. Otherwise fall back to
CORTEX_API_KEY.A job in CI cannot sign in
A job in CI cannot sign in
It tried the browser flow. Use
cortex login --with-api-key or cortex login --token, or set CORTEX_API_KEY in the job environment and skip cortex login entirely.The CLI asks you to sign in again
The CLI asks you to sign in again
The stored session expired or was cleared. Run
cortex login again. If it keeps happening on the same machine, the credential store is probably not persisting between runs; the two checks above apply.