Skip to content

Login

There is one identity: your Prudai account in Keycloak (login.prudai.com). The CLI and MCP never log in with a Prudai password, a personal token or a key per product. Service keys exist only for your own applications.

  1. prudai login starts the device flow (RFC 8628) with the public client prudai-cli. The CLI prints a link URL and a code and opens the browser if there is one. On a machine without a browser, use prudai login --no-browser.
  2. You approve the code on login.prudai.com, with your own account and the MFA that applies there. That can be on any other device.
  3. The CLI stores the session in ~/.config/prudai/config.json with file mode 0600. Product tokens never reach the disk.
  4. The CLI exchanges the token per product. For every call the CLI asks the token broker (https://mcp.prudai.com/oauth/exchange) for a token for exactly one product. The broker does the standard token exchange (RFC 8693) with Keycloak.
  5. The product sees only that token. It lives 5 minutes, has one audience, has no refresh token and stays in the memory of the process. The product checks issuer, audience, expiry and organisation.
Terminal window
prudai login # device login
prudai whoami # who, organisation, effective permissions
prudai auth status --online # proves the session is still alive
prudai auth logout # ends the session at Keycloak, then clears it locally

prudai auth logout ends the session at Keycloak. Revoking a session works immediately for new tokens; a token that was already exchanged expires within 5 minutes. A session that was revoked or stayed idle for 30 days gives not_authenticated with the step to log in again.

A login belongs to one organisation. For another organisation, use another profile:

Terminal window
prudai profile create client-b
prudai auth login --profile client-b

Automation of the CLI uses the same login. A person approves the code; then you move the session to the runner:

Terminal window
prudai auth export --reveal | <secret store> # on the machine where you logged in
printf %s "$TOKEN" | prudai auth set --stdin # on the runner

The environment variable PRUDAI_REFRESH_TOKEN also works; it wins from the config file and writes nothing. A refresh token is a login: store it like a password.

An assistant that speaks MCP logs in with OAuth at the same Keycloak. See MCP.