Skip to content

The device flow, for CLIs and AI agents

How a CLI or an AI agent signs in for you without anyone pasting a secret, keeps a session that can last forever, and how you revoke it.

Applies to EngineCloud
View as Markdown
On this page
  1. Signing in
  2. The agent starts
  3. You approve
  4. The agent receives its session
  5. Where it is kept
  6. How long it lasts
  7. Revoking

An agent that manages your backend needs a credential that works for a long time, that nobody had to copy into a chat, and that you can take back. The device flow (RFC 8628) gives exactly that, with DPoP on top.

Signing in

  1. The agent starts

    Terminal
    npx @sypnia/data login --project <ref>

    It generates a key pair on your machine and asks the project for a device code.

  2. You approve

    Text
    Open https://data.app.sypnia.com/device and enter the code  WXYZ-1234

    You open it signed in. The page shows the device name, the agent, and the scopes it asks for. You approve, or deny. Codes expire after 10 minutes. Approving privileged scopes (sql:*, auth:admin, project:admin) needs an account an admin entitled to them; otherwise the approval fails with 403 scope_not_allowed. With no --scope, npx @sypnia/data login asks for data:read data:write offline_access.

  3. The agent receives its session

    The CLI was asking every 5 seconds; now it receives an access token and a refresh token, both bound to its key with DPoP, in a session of its own.

Where it is kept

Text
~/.config/sypnia/credentials.json   the project and the refresh token     (mode 600)
~/.config/sypnia/agent-key.json     the private key                       (mode 600)

The refresh token is useless without the private key, and the private key never leaves your machine.

How long it lasts

The session follows the policy of the client that started it. The sypnia CLI client’s default is never expires and never times out: the agent keeps working until you revoke it. A project can change that policy, for example to 90 days of inactivity.

Revoking

  • In the console → Account → Agents and devices: every agent session with its name, its scopes, where it was last used and when. Revoke ends it at once: its next refresh fails.
  • npx @sypnia/data logout on the machine ends the session and deletes both files.
  • Deleting the key file makes the session unusable even if the token leaked.
  1. Signing in
  2. The agent starts
  3. You approve
  4. The agent receives its session
  5. Where it is kept
  6. How long it lasts
  7. Revoking

    Search pages, sections and terms