OAuth 2.1
Summary
Benevia Core includes a complete OAuth 2.1 authorization server. It lets OAuth-capable clients — such as Claude and ChatGPT custom connectors — get delegated, scoped access to your API on behalf of a signed-in user. Clients register themselves, the user approves access on a consent screen your app hosts, and the client receives tokens with the access the user chose.
Key properties:
- Stateless client registration — the
client_idis the registration data, HMAC-signed by the server. Nothing is stored, so any client can self-register without an admin step. - PKCE everywhere — all clients are public clients; authorization code + PKCE is the only interactive flow.
- Multi-tenant without tenant URLs — endpoints are rootless (
/connect/...); the tenant travels inside the authorization code and token claims. - Two access presets — the user grants Read only or Full access per connection. Either way the app gets the user's own access; Read only gets just the reads of it.
How a client connects
Discovery → Registration → Authorize → Sign-in + Consent → Code → Tokens → Bearer requests
- The client reads
/.well-known/oauth-protected-resourceand/.well-known/openid-configurationto find the endpoints. - It registers itself at
POST /connect/registerand receives a self-encodedclient_id. - It opens
GET /connect/authorizein the user's browser. Core redirects to your app's consent page. - The user signs in and picks Read only or Full access. Your app records the choice via
POST api/oauth/consent/approve. - The browser returns to
/connect/authorize; Core issues an authorization code bound to the user's tenant. - The client exchanges the code (plus its PKCE verifier) at
POST /connect/tokenfor access and refresh tokens. - The client calls
/mcpand the OData API withAuthorization: Bearer <access token>.
Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/.well-known/openid-configuration |
GET | Authorization-server discovery document |
/.well-known/oauth-protected-resource |
GET | Protected-resource metadata for MCP clients (mapped by UseCoreMcp()) |
/connect/register |
POST | Dynamic Client Registration (anonymous) |
/connect/authorize |
GET | Authorization endpoint — consent and code issuance |
/connect/token |
POST | Token endpoint — code exchange and refresh |
/connect/revoke |
POST | Token revocation |
api/oauth/consent/info |
GET | Client name and scope descriptions for your consent UI |
api/oauth/consent/approve |
POST | Records the user's consent choice |
api/oauth/connected-apps |
GET | The current user's connected apps |
api/oauth/connected-apps/{grantId}/disconnect |
POST | Revokes a connection and all its tokens |
Scopes
| Scope | Grants |
|---|---|
benevia.read |
Read only: what the user can read, and the methods declared MethodType.Read that the user can call |
benevia.write |
Full access: everything the user can do |
benevia.delete |
Legacy only: the same as benevia.write, for apps that connected when delete was a separate level |
offline_access |
Refresh tokens (plumbing — not shown to users) |
A connected app gets its user's own responsibilities, never more. Read only gets just their reads, so for a user with limited access it reads only what that user can read. Read only and Full access are app access levels, not the built-in Read all and Full access responsibilities. The admin API is never delegated, even by an administrator. A connection with no data scope has no data access.
Connections approved before the presets keep working with the scopes they hold. A connection approved to write but not delete can now delete too. For an app that may write but never delete, give its user a role without delete and approve Full access.
Guides
| Guide | Covers |
|---|---|
| Setup | Wiring AddCoreOAuth into your host and the required configuration |
| Consent page | The consent UI contract your client app must implement |
| Connected apps | Letting users list and disconnect their connections |
| MCP connectors | Connecting Claude / ChatGPT end to end, and troubleshooting |
Notes
- Token and grant state (codes, refresh tokens, grants) is stored per tenant; client registrations are never stored.
- A user can connect the same client several times; each connection is an independent grant.
- Connected apps can't use the admin API (users, roles, invitations and password resets), personal access tokens, or automations.
- See Expose entities via MCP for the MCP server itself and Use your API for JWT sign-in used by first-party clients.