Skip to content

Machines and agents

How services, CLIs, MCP clients and AI agents sign in to a project with standard OAuth 2.0, and which credential to use when.

Applies to EngineCloud
View as Markdown
On this page
  1. Which credential, when
  2. Scopes
  3. Who may hold the privileged scopes

Much of what touches a backend today is not a person: services, scheduled jobs, CLIs, MCP clients, AI agents. Sypnia Data treats them as first-class callers, with standard protocols, not home-made ones. Each project is an OAuth 2.0 authorization server at /auth/v1/oauth, described at /.well-known/oauth-authorization-server.

Which credential, when

Who is callingUseWhy
A service of yours, acting as itselfClient credentials with a key pairNo shared secret; tokens last minutes
A CLI or an AI agent acting for youThe device flowYou approve in the browser; nothing is pasted
An MCP client (Claude, Cursor)MCP with OAuthThe protocol MCP specifies
A quick script or an integrationA personal access tokenOne string, scoped, revocable
Your app in a browser or a phoneThe publishable key plus the user’s sessionRow-level security decides
A trusted server that needs everythingA secret keyFull access; never in a browser

Any token can be made sender-constrained with DPoP: it then works only with a proof signed by the caller’s private key.

  • Client credentials

    A service signs in as itself with a key pair (private_key_jwt) or a secret, and gets a short token with the scopes it needs.

  • DPoP, tokens bound to a key

    Make a token useless to anyone who steals it, by binding it to the caller's private key with DPoP (RFC 9449).

  • 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.

  • Personal access tokens and API keys

    Long-lived tokens that act as a user, and the publishable and secret keys of a project, with their formats, scopes and how to revoke them.

  • MCP

    Connect Claude, Cursor or any MCP client to Sypnia Data with OAuth, at one address for every project, and the tools it can call.

Scopes

A machine token carries scopes. The built-in ones:

ScopeAllows
data:read, data:writethe Data API, as the client’s database role
sql:read, sql:writethe SQL endpoint (read-only or not)
auth:adminthe auth admin API (users, sessions)
project:admineverything, as service_role

Projects can define their own scopes and check them in policies with sypnia.scopes().

Who may hold the privileged scopes

sql:read, sql:write, auth:admin and project:admin reach the owner role or the admin API, so nobody gets them by signing up:

  • A machine client (client credentials) gets them from its registration, which only an admin creates with the secret key.
  • A person gets them only if an admin lists them in the user’s app_metadata.scopes with the secret key: PUT /auth/v1/admin/users/{id} with {"app_metadata": {"scopes": ["sql:read"]}}. Without that, a PAT, a device approval or a consent that asks for one fails with 403 scope_not_allowed. A token issued earlier loses the scope at its next use (within 60 seconds) once the admin takes it back.
  • With no scope named, the device flow and the authorization code flow ask only for the non-privileged scopes of the client.
  • Open dynamic client registration never grants them.

Changes to the account itself (password, e-mail, PATs, sessions, linked identities) need the person’s own session. A PAT or an app acting for the person cannot make them.

  1. Which credential, when
  2. Scopes
  3. Who may hold the privileged scopes

    Search pages, sections and terms