Overview
Twenty implements OAuth 2.0 with authorization code + PKCE for user-facing apps and client credentials for server-to-server access. Clients are registered dynamically via RFC 7591 — no manual setup in a dashboard.When to Use OAuth
Register a Client
Twenty supports dynamic client registration per RFC 7591. No manual setup needed — register programmatically:Scopes
Request scopes as a space-separated string:
scope=api profile
Authorization Code Flow
Use this flow when your app acts on behalf of a Twenty user.1. Redirect the user to authorize
Take the exact URL from
authorization_endpoint in Server Discovery: when the API and the app are served from different hosts, /authorize lives on the app host.
The user sees a consent screen and approves or denies access.
2. Handle the callback
After authorization, Twenty redirects back to yourredirect_uri:
state matches what you sent.
3. Exchange the code for tokens
client_secret. If you used PKCE in the authorization request, also send code_verifier. Public clients, including dynamically registered ones, have no secret: omit client_secret and send code_verifier.
Response:
4. Use the access token
5. Refresh when expired
client_secret.