/v1/oauth/tokenOAuth 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"
codestringThe single-use authorization code. `authorization_code` grant only.
code_verifierstringPKCE verifier. Required on the `authorization_code` grant — there is no non-PKCE path.
redirect_uristringMust be byte-identical to the `redirect_uri` used at `/authorize`. `authorization_code` grant only.
refresh_tokenstringThe rotating refresh token. `refresh_token` grant only.
client_idstringClient identifier. Required for public clients; confidential clients may instead use HTTP Basic.
client_secretstringClient secret for `client_secret_post` authentication.
scopestringNarrowed 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.
resourcestringRFC 8707 resource indicator. Must match the one the grant was created for.
Response · 200
access_token*stringSigned 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*stringExample: "Bearer"
expires_in*numberSeconds until the access token expires (≤ 900).
Example: 900
refresh_token*stringRotating refresh token. The one presented is consumed; replaying it revokes the whole grant family.
scope*stringPreset name(s) the grant started from. Present for RFC 6749 §5.1 compliance; it is not the authority — `policy` is.
Example: "mail"
policy*arrayThe 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 · uuidWorkspace 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"
}