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.
How it works
Section titled “How it works”prudai loginstarts the device flow (RFC 8628) with the public clientprudai-cli. The CLI prints a link URL and a code and opens the browser if there is one. On a machine without a browser, useprudai login --no-browser.- 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. - The CLI stores the session in
~/.config/prudai/config.jsonwith file mode 0600. Product tokens never reach the disk. - 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. - 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.
prudai login # device loginprudai whoami # who, organisation, effective permissionsprudai auth status --online # proves the session is still aliveprudai auth logout # ends the session at Keycloak, then clears it locallyLogging out and revoking
Section titled “Logging out and revoking”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.
Multiple organisations
Section titled “Multiple organisations”A login belongs to one organisation. For another organisation, use another profile:
prudai profile create client-bprudai auth login --profile client-bAutomation
Section titled “Automation”Automation of the CLI uses the same login. A person approves the code; then you move the session to the runner:
prudai auth export --reveal | <secret store> # on the machine where you logged inprintf %s "$TOKEN" | prudai auth set --stdin # on the runnerThe 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.
Logging in from an assistant
Section titled “Logging in from an assistant”An assistant that speaks MCP logs in with OAuth at the same Keycloak. See MCP.