Skip to content
Dashboard
Theme
Theme

Exchange a confined WorkOS compatibility code

POST /sso/token: Exchange a confined WorkOS compatibility code.

View Markdown

POST /sso/token

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
  • grant_type string Required

    one of authorization_code

  • client_id string Required

    A live OhAuthCat publishable key, replacing the original vendor client identifier.

    min length 1 · max length 256

  • client_secret string Required

    OhAuthCat secret API key with sso:exchange in the same environment; never persisted or logged.

    min length 1 · max length 256

  • code string Required

    min length 1 · max length 32768

  • code_verifier string

    Optional SDK field; it never overrides the internally enforced sealed PKCE verifier.

    max length 128

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/sso/token" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"client_id": "client_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"client_secret": "sk_test_example",
"code": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5"
}'
Response 200
{
"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": {}
}
}