Skip to content

Token endpoint: authorization_code, refresh_token and token exchange (RFC 8693).

POST
/oauth/token
curl --request POST \
--url https://api.contentsurface.io/oauth/token

Issues tokens, as application/x-www-form-urlencoded:

  • grant_type=authorization_code — a login client redeems the code with its code_verifier and redirect_uri, and gets an access token (15 minutes) and a refresh token. - grant_type=refresh_token — a new access token and a new refresh token; the old refresh token is spent. A sign-in session lasts as long as it is refreshed at least every 30 days; one started with Microsoft or Google ends after the tenant’s federated session lifetime. - grant_type=urn:ietf:params:oauth:grant-type:token-exchange — an impersonating client, authenticated with HTTP Basic (its client_id and a secret), gets an access token for one related user: subject_token is the user’s ID (usr_…), subject_token_type is urn:contentsurface:token-type:user-id, and the scope is cs.content only.

An AI application (MCP client) uses the first two with its metadata document’s address as client_id and no secret, at the tenant address; its tokens are for the MCP endpoint (resource) only and carry cs.content. They stop working when the person or a tenant admin revokes the grant or MCP access is turned off. Through the global MCP address it redeems at https://auth.contentsurface.io/oauth/token: its codes and refresh tokens name their workspace, and its tokens are for the global MCP endpoint. A code or refresh token is redeemed only where it was issued.

Errors follow OAuth 2.0: invalid_client, invalid_grant (also when the client may not act for the user, or the user is not active), invalid_request, invalid_scope, unsupported_grant_type.

OK