Custom integrations can obtain short-lived tokens for the MCP endpoint using the authorization code flow with PKCE (S256 only). Endpoints are listed at /.well-known/oauth-authorization-server.
Good to know
The authorization step is an API call made with the signed-in owner's session, and it returns the code in the response. It is not a hosted consent screen that redirects the browser. If your client expects one, connect it with an API key instead.
The flow
- Create a random
code_verifier(43 to 128 characters) and its SHA-256 challenge, base64url encoded. - As a signed-in user who can manage the site's settings, call
POST /api/oauth/authorizewithsite,clientId,redirectUri,codeChallengeand eitherpresetorscopes. - Exchange the code at
POST /api/oauth/tokenwithin 5 minutes. Each code works once. - Send the access token to
/api/mcpasAuthorization: Bearer.
POST https://xigzag.com/api/oauth/token
Content-Type: application/json
{
"grant_type": "authorization_code",
"code": "<code>",
"client_id": "my-integration",
"redirect_uri": "https://example.com/callback",
"code_verifier": "<verifier>"
}The preset ids are read_only, content_editor, store_manager and full_draft. The token endpoint expects a JSON body.
Token lifetime and refresh
- Access tokens last 1 hour.
- To refresh, send
grant_typeset torefresh_token, withrefresh_token. You get a new pair and the old pair stops working. - The owner can revoke all OAuth tokens for a site with
POST /api/oauth/revoke. - If a refresh is refused, run the authorization flow again. Build your integration to handle this.
Use OAuth tokens with the MCP endpoint. For the REST API, use an API key.
