Skip to main content

Login

With nothing configured, vagaris auth login signs in to Vagaris Cloud: the CLI reads https://vagaris.org/.well-known/vagary to find the API and its sign-in service. Sign-in always goes through Vagaris's identity service, in your browser or with --device on a machine without one; the CLI never asks for a password. To sign in to a dedicated Vagaris service, save its address as a profile with vagaris context set --service-root <url>.

Board login​

vagaris auth login

What happens, in order:

  1. For Vagaris Cloud (or a dedicated service root), the CLI first reads the service root's discovery document and sends requests to the API it advertises. It follows at most one redirect, over HTTPS, to the root's own host or a subdomain, and refuses a document for another product. It then fetches the deployment's identity configuration from GET /api/cli-auth/oidc-config, refuses if that names a different issuer from the one the discovery document advertised, and runs OpenID Connect discovery against the issuer. The saved session is keyed by the service root, not by the API host it resolved to, so a move of the API host does not sign you out.
  2. It starts a loopback callback listener and prints a one-time authorization URL (authorization code flow with PKCE, prompt=consent so a refresh token is granted). It opens a browser only when you explicitly request that.
  3. After you sign in, the callback receives the code, the CLI exchanges it for tokens and calls GET /api/cli-auth/me to confirm the identity.
  4. The access token, refresh token and credential metadata are saved together in the CLI’s private auth.json file for this API base. The default is ~/.vagaris/auth.json; an explicitly configured home or credential-file path remains authoritative. The directory must be mode 0700 and the file mode 0600. Writes use an atomic rename, and concurrent CLI processes share refresh locking. A storage failure is reported; it does not silently switch to another backend.

File storage is the explicit default. Old OS-store marker records are left inactive and existing Keychain/Secret Service items are untouched. A new verified sign-in replaces only its API record, preserving other profiles. Use the same current CLI build across processes sharing a profile. Tokens are never printed by login or placed in command arguments.

For a canonical platform/operator identity, use the explicitly configured operator entry:

vagaris auth login --operator

--operator signs you in as a member of the platform operator population, through its own operator entry. It does not create a new admin identity, link accounts by email, or grant organization or instance permissions. Where the service offers no operator entry, the command refuses rather than silently sending you to customer sign-in. Ordinary auth login keeps the customer entry. Stored operator mode survives refresh and automatic reauthentication.

Authentication and local authorization are separate: linked: false means the identity authenticated but has no explicit link to a local board user. An already-authorized instance administrator must establish that immutable-subject link through the existing user-management API. Repeated password attempts or a duplicate per-product admin account do not repair a missing link.

--instance-admin makes login fail unless the signed-in identity already holds instance-admin. Use it when you are about to run an admin-only command and want a clear error up front.

Output includes apiBase, userId, whether the identity is linked to a board user, and persisted.

Automatic recovery​

You rarely need to run auth login by hand. When a client command gets a 401, or a 403 whose message says board access or instance-admin is required, and both stdin and stdout are terminals, the CLI first tries to refresh a stored OIDC credential and otherwise starts the login flow inline, then retries the request. In a non-interactive context (CI, piped output) no browser flow is attempted and the command exits with code 3.

Who am I​

vagaris auth whoami

Returns the user record, instance roles, isInstanceAdmin, isOperator, the company ids the identity can see, the credential source, and linked.

Logout​

vagaris auth logout

Revokes the stored credential server-side, then removes it locally. If the server-side revoke fails the local credential is still removed; the output reports both revoked and removedLocalCredential.

Move existing CLI state without signing in again​

If a previous installation keeps CLI credentials or profiles under ~/.vagris, stop other CLI processes, then run:

vagaris auth migrate-state --dry-run --json
vagaris auth migrate-state --json

The command moves private auth.json and context.json files into ~/.vagaris without changing their bytes, profiles or selected profile. It does not refresh tokens or contact Identity. Explicit custom home, context and credential paths remain explicit; this command upgrades only the default home locations.

Old auth/context filenames become private directory markers, so an older CLI cannot read or overwrite the moved credentials. Do not replace those markers with credential symlinks. If the process stops partway through, rerun the same command to resume; do not delete its migration journal. Conflicting roots, unsafe permissions and active credential operations are refused without merging credentials.

Runtime instances, databases, workspaces and node keys stay at their existing paths. Their migration is separate. Continue using your intended profile explicitly, for example --profile work; moving state does not select a different profile.

Browser operator sign-in​

Operators sign in with their platform account through the identity service. A private/incognito window is not required. An authenticated identity still needs an explicit, administrator-approved subject link; another account with the same email does not inherit access.

Browser sign-in explicitly reauthenticates and verifies the issuer's auth_time and nonce. The server stores encrypted, session-bound proof and never exposes upstream tokens through the browser session API. Operator sessions expire no later than their verified token bounds; this first slice does not silently refresh them, so expiry requests another sign-in. Sign-out ends the session on this deployment; it is not a fleet-wide logout.

Revocation uses the canonical verifier's known-revocation cache. After initial synchronization that cache retains its last-known state during feed outages; immediate fleet-wide revocation during an outage is not guaranteed. Token expiry and current local subject-link checks remain enforced.

GitHub workload authentication​

vagaris auth workload uses Core Identity's existing workload exchange. It requires a conferred GitHub trust binding and an active Vagaris machine path; it creates no binding, permission grant or human role.

vagaris auth workload \
--api-base https://vagaris.example.com \
--company-id <company-uuid> \
--assertion-audience <exact-audience-from-the-binding> \
--token-output <new-private-token-file> \
--json

The command requests the job's assertion from GitHub, discovers the deployment's configured Identity issuer, exchanges it as the public workload-federation client, and verifies the resulting workload and company through the resource's own identity endpoint. The assertion audience must come from the existing binding; there is no inferred default. A caller with an assertion already available may use --assertion-stdin instead. Assertions are never accepted as command-line arguments.

The token is saved to a new file with 0600 permissions after resource verification. Existing files and the human/product credential stores remain untouched. Normal output contains identity, expiry and file metadata, never a bearer or refresh token. Subsequent commands may consume it through their existing VAGARIS_API_KEY environment variable; disable shell tracing, mask the value in CI logs, and remove the temporary file when the job finishes. Exchange failures are not retried automatically: a submitted assertion can already have been consumed even if its response was lost.

GitHub supplies ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN to jobs with permissions: id-token: write; requesting an assertion does not grant access to the downstream resource. This command currently supports the GitHub.com Actions issuer. See GitHub's OpenID Connect reference (checked 2026-09-30).

API keys​

An agent API key authenticates as an agent rather than as a board user. It is what vagaris heartbeat run, the MCP server and a local coding agent use.

  • Create one for an agent with vagaris agent local-cli <agent> --company-id <id> — it prints shell export lines for the key, API base, company and agent ids. See Coding-Agent Integration.
  • Pass it with --api-key <token>, or set VAGARIS_API_KEY (the older VAGRIS_API_KEY is also read).
  • Prefer keeping it out of the context file: vagaris context set --api-key-env-var-name VAGARIS_API_KEY records the name of the variable, and the CLI reads the value from your environment at run time.

Credential precedence​

For every client command the CLI resolves, in this order, and stops at the first hit:

ValueOrder
API base--api-base → profile apiBase → profile serviceRoot → VAGARIS_API_URL / VAGARIS_API_URL (compatibility) → the project manifest's endpoint → Vagaris Cloud (https://vagaris.org). A service root is resolved to its API through /.well-known/vagary; there is no localhost default
Credential--api-key → VAGARIS_API_KEY / VAGARIS_API_KEY → the env var named by the profile's apiKeyEnvVarName → the stored board credential for that API base
Company--company-id → VAGARIS_COMPANY_ID / VAGARIS_COMPANY_ID → profile companyId

An explicit API key disables the automatic board-login recovery, so a script that sets VAGARIS_API_KEY never opens a browser.