Overview

The OAuth API lets authenticated users authorize third-party Allternit clients — such as the browser extension and the Gizzi code agent — to act on their behalf. It implements a minimal OAuth 2.0-style authorization-code flow: the user is already authenticated through the platform auth middleware, the endpoint validates the client and redirect URI, and then redirects back to the client with a short-lived authorization code. All OAuth routes are mounted under /api and require a valid bearer token via the platform auth middleware.

Base URL

For local development:

Authentication

All requests must include a valid bearer token in the Authorization header. The middleware resolves the token to the calling user and stores the authorization code bound to that user. See Authentication for details.

Supported clients and redirect URIs

The authorize endpoint only allows the following registered client_id values: Allowed redirect_uri schemes depend on the client: The legacy allternit-desktop client ID is retired. Requests that use it receive HTTP 410 Gone with instructions to use runtime device pairing at https://platform.allternit.com/pair.

Endpoints

Authorize a client

Validates the client and redirect URI, generates a unique authorization code, persists it in the mcp_oauth_sessions table bound to the authenticated user, and returns an HTTP 302 Found redirect to the supplied redirect_uri with code and state query parameters. The generated code is a one-time UUID stored as the session ID. The session is marked authenticated and records the redirect URI, optional user email, optional PKCE challenge, and creation timestamp.

Request body

Example request

Example response — success

On success the endpoint responds with HTTP 302 Found and a Location header:
The client should capture the code and exchange it for tokens through its own token flow.

Example response — retired desktop client

Example response — invalid redirect URI

Revoke user sessions

Deletes all mcp_oauth_sessions rows for the target user. By default the target is the authenticated caller; an administrator-style caller may supply a different user_id to revoke that user’s sessions.

Request body

Example request

Example response

Error codes