Exchange a confined WorkOS compatibility code
POST /compat/workos/sso/token: Exchange a confined WorkOS compatibility code.
POST /
Requires the deployment and environment compatibility flags. Authenticates client_secret in the JSON or form-encoded body, binds the live publishable client_id to the same environment, and uses only the redirect and internal PKCE verifier sealed in the compatibility code. Native codes are refused before consumption or revocation.
- Scope
sso:exchange- Auth
- None
- Since
- 1.0
Request body
Section titled “Request body”grant_typestring Requiredone of
authorization_code
A live OhAuthCat publishable key, replacing the original vendor client identifier.client_idstring Requiredmin length 1 · max length 256
OhAuthCat secret API key with sso:exchange in the same environment; never persisted or logged.client_secretstring Requiredmin length 1 · max length 256
codestring Requiredmin length 1 · max length 32768
Optional SDK field; it never overrides the internally enforced sealed PKCE verifier.code_verifierstringmax length 128
Responses
Section titled “Responses”- 200 Compatibility access token and normalized profile WorkosToken
- 400 Invalid request. Codes: parameter_invalid, parameter_missing, version_unsupported and resource-specific codes from the catalogue. Error
- 401 Codes: authentication_required, api_key_invalid. Error
- 403 Codes: api_key_scope_missing, ip_not_allowed, plan_limit_reached. Error
- 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
Errors share one shape; see the error code catalogue.
curl -X POST \ "https://api.ohauthcat.com/compat/workos/sso/token" \ -H "Content-Type: application/json" \ -d '{ "grant_type": "authorization_code", "client_id": "client_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "client_secret": "sk_test_example", "code": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5"}'const response = await fetch("https://api.ohauthcat.com/compat/workos/sso/token", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ "grant_type": "authorization_code", "client_id": "client_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "client_secret": "sk_test_example", "code": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5" }),});const data = await response.json();import osimport requests
response = requests.post( "https://api.ohauthcat.com/compat/workos/sso/token", json={ "grant_type": "authorization_code", "client_id": "client_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "client_secret": "sk_test_example", "code": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", },)data = response.json(){ "access_token": "sk_test_example", "token_type": "Bearer", "expires_in": 1, "profile": { "id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "object": "profile", "connection_id": "conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "connection_type": "GenericSAML", "organization_id": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "idp_id": "0oa1b2c3d4E5F6g7h8i9", "email": "jane@acme.com", "first_name": "Jane", "last_name": "Doe", "name": "Acme Corp", "role": { "slug": "acme" }, "roles": [ { "slug": "acme" } ], "groups": [ "Engineering" ], "custom_attributes": {}, "raw_attributes": {} }}