Platform API reference

Platform API · Oauth-Authorization-Server

post/v1/oauth/token

OAuth 2.1 token endpoint

Accepts `authorization_code` (with a mandatory `code_verifier`) and `refresh_token`. Both credentials are single-use: replaying a code or a refresh token issues nothing and revokes the entire grant family, so anything already minted from that grant stops working immediately.

Request body

grant_type*string

`authorization_code` or `refresh_token`.

Example: "authorization_code"

codestring

The single-use authorization code. `authorization_code` grant only.

code_verifierstring

PKCE verifier. Required on the `authorization_code` grant — there is no non-PKCE path.

redirect_uristring

Must be byte-identical to the `redirect_uri` used at `/authorize`. `authorization_code` grant only.

refresh_tokenstring

The rotating refresh token. `refresh_token` grant only.

client_idstring

Client identifier. Required for public clients; confidential clients may instead use HTTP Basic.

client_secretstring

Client secret for `client_secret_post` authentication.

scopestring

Narrowed preset name(s) on the `refresh_token` grant. A preset the original grant did not carry is rejected; narrowing keeps every deny and only removes actions, so it can never widen.

resourcestring

RFC 8707 resource indicator. Must match the one the grant was created for.

Response · 200

access_token*string

Signed JWT, audience-bound to the resource indicator and carrying the workspace, the preset name and the client id. It carries no policy — authority is resolved per request from the grant row and the human’s live policy.

token_type*string

Example: "Bearer"

expires_in*number

Seconds until the access token expires (≤ 900).

Example: 900

refresh_token*string

Rotating refresh token. The one presented is consumed; replaying it revokes the whole grant family.

scope*string

Preset name(s) the grant started from. Present for RFC 6749 §5.1 compliance; it is not the authority — `policy` is.

Example: "mail"

policy*array

The policy this token carries. Effective authority is this intersected with the authorizing human's current workspace policy, re-evaluated on every call.

workspace_id*string · uuid

Workspace the grant is scoped to.

Example

Request

POST https://api.platform-auth.productcraft.co/v1/oauth/token
Content-Type: application/json

{
  "grant_type": "authorization_code",
  "code": "string",
  "code_verifier": "string",
  "redirect_uri": "string",
  "refresh_token": "string",
  "client_id": "string",
  "client_secret": "string",
  "scope": "string",
  "resource": "string"
}

Response

{
  "access_token": "string",
  "token_type": "Bearer",
  "expires_in": 900,
  "refresh_token": "string",
  "scope": "mail",
  "policy": [
    {
      "effect": "allow",
      "actions": [
        "social.read",
        "social.list"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "workspace_id": "00000000-0000-0000-0000-000000000000"
}