ChatofyDevelopers
REST APIMCP Server (AI)New
API KeysWebhooks
Chatofy API
/
Getting Started
API Resources
API v1.0 Live
Developer APIModel Context Protocol (MCP)MCP OAuth 2.0 PKCE Token Exchange

MCP OAuth 2.0 PKCE Token Exchange

Exchanges an authorization code and PKCE code verifier for an organization MCP Bearer access token. Used by "claude mcp login" and remote AI agents.

POST/api/mcp/oauth/token

Body Parameters

5 parameters
grant_typestring (required)required

Must be "authorization_code"

codestring (required)required

Transient authorization code from /auth/mcp/authorize

client_idstring (required)required

Client ID issued by /api/mcp/oauth/register (or sent via HTTP Basic auth)

redirect_uristring (required)required

Callback URL matching the authorize request

code_verifierstring (required)required

PKCE S256 code verifier secret (RFC 7636)

Response Payload

200 OKapplication/json
statusstring

"1" = Success, "0" = Failure.

messageobject

The response data payload.

Code Snippets & Examples

1curl -X POST "https://app.chatofy.in/api/mcp/oauth/token" \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{"grant_type":"authorization_code","code":"cfy_auth_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef","client_id":"cfy_mcp_3f9a1c2b4d5e6f708192a3b4c5d6e7f8","redirect_uri":"http://localhost:51123/callback","code_verifier":"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"}'

Was this endpoint guide helpful?

Previous Endpoint
MCP OAuth 2.0 Dynamic Client Registration
Next Endpoint
MCP OAuth User & Workspace Info
© 2026 Chatofy Cloud Platform. All rights reserved.
1curl -X POST "https://app.chatofy.in/api/mcp/oauth/token" \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{"grant_type":"authorization_code","code":"cfy_auth_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef","client_id":"cfy_mcp_3f9a1c2b4d5e6f708192a3b4c5d6e7f8","redirect_uri":"http://localhost:51123/callback","code_verifier":"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"}'
200 OKapplication/json
1{
2 "access_token": "cfy_sk_live_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
3 "token_type": "Bearer",
4 "expires_in": 31536000,
5 "scope": "all"
6}