Skip to content

OAuth 2.1 (MCP clients)

These endpoints exist so remote MCP clients can obtain a Deskew credential without a user ever pasting a key. They follow OAuth 2.1 as the MCP authorization specification requires: public clients, PKCE S256 mandatory, dynamic client registration, server metadata. If you are integrating with the API from your own backend, use an API key instead.

URL Purpose
https://mcp.deskew.dev/.well-known/oauth-protected-resource Protected-resource metadata of the hosted MCP server; names https://api.deskew.dev as its authorization server
https://api.deskew.dev/.well-known/oauth-authorization-server RFC 8414 metadata: endpoints, code_challenge_methods_supported: ["S256"], token_endpoint_auth_methods_supported: ["none"], scopes

A client that receives 401 with WWW-Authenticate: Bearer resource_metadata="…" from the MCP server follows these two documents to find the endpoints below.

Dynamic client registration (RFC 7591). Open, rate limited per IP (30 per hour), public clients only.

{ "client_name": "Claude", "redirect_uris": ["https://claude.ai/api/mcp/auth_callback"] }

redirect_uris must be https:// URLs, or http://localhost / http://127.0.0.1 with any port for native clients. Answers 201:

{
"client_id": "oac_01JE…",
"client_id_issued_at": 1764972003,
"client_name": "Claude",
"redirect_uris": ["https://claude.ai/api/mcp/auth_callback"],
"token_endpoint_auth_method": "none",
"grant_types": ["authorization_code"],
"response_types": ["code"],
"scope": "extract:write jobs:read extractors:read extractors:write"
}

Errors use the OAuth shape { "error", "error_description" }: invalid_redirect_uri, invalid_client_metadata.

Query
response_type code
client_id from registration
redirect_uri one of the registered URIs, exactly
code_challenge, code_challenge_method PKCE; only S256 is accepted
scope space-separated subset of extract:write jobs:read extractors:read extractors:write; unknown scopes are dropped; empty means extract:write jobs:read extractors:read
state returned unchanged
resource optional RFC 8707 indicator, recorded

An unknown client_id or an unregistered redirect_uri answers 400 JSON and never redirects. Other problems redirect back with error=invalid_request (or unsupported_response_type) and state. A valid request redirects the browser to https://app.deskew.dev/connect?req=…, a signed copy of the request valid for 10 minutes, where the signed-in user approves.

GET /dashboard/oauth/request?req= describes the request: client name, redirect host, scopes in words, the organization’s projects, whether live mode is allowed. POST /dashboard/oauth/consent with { "req", "approve": true, "project_id", "mode": "live" | "test" } answers { "redirect_url" } carrying code and state; approve: false answers a redirect with error=access_denied. Approving needs the admin or owner role; live mode needs a verified email.

Form-encoded: grant_type=authorization_code, code, code_verifier, and optionally client_id and redirect_uri (checked when present).

{ "access_token": "deskew_live_sk_…", "token_type": "Bearer", "scope": "extract:write jobs:read extractors:read" }

Codes live 10 minutes and work once. A second exchange of the same code answers invalid_grant and revokes the key the first exchange issued (RFC 6749 §4.1.2). A wrong code_verifier answers invalid_grant without consuming the code. Rate limited per IP (60 per 15 minutes).

Form-encoded token=. Revokes the key behind the token and records oauth.token_revoked in the audit log. Always 200, whether or not the token existed.

oauth.consent_granted (who connected which app to which project), api_key.created with metadata.source: "oauth", and oauth.token_revoked.