Token endpoint: authorization_code, refresh_token and token exchange (RFC 8693).
const url = 'https://api.contentsurface.io/oauth/token';const options = {method: 'POST'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.contentsurface.io/oauth/tokenIssues tokens, as application/x-www-form-urlencoded:
grant_type=authorization_code— a login client redeems the code with itscode_verifierandredirect_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 (itsclient_idand a secret), gets an access token for one related user:subject_tokenis the user’s ID (usr_…),subject_token_typeisurn:contentsurface:token-type:user-id, and the scope iscs.contentonly.
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.
Responses
Section titled “Responses”OK