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.
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
You approve
Text Open https://data.app.sypnia.com/device and enter the code WXYZ-1234You 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 with403 scope_not_allowed. With no--scope,npx @sypnia/data loginasks fordata:read data:write offline_access.
Where it is kept
~/.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 logouton the machine ends the session and deletes both files.- Deleting the key file makes the session unusable even if the token leaked.