Herald
OpenapiOauth

Oauth_token

POST
/api/oauth/{realmId}/token

Path Parameters

realmId*string

Realm ID

Request Body

Dual encoding per openid-connect.md §5.1: JSON (first-party flow) or RFC 6749 §4.1.3 form-urlencoded (standard OIDC/MCP clients); both deserialize into the same snake_case field names. Grants: authorization_code (all clients), refresh_token (built-in MCP client only)

  1. body

OAuth 2.0 token request (RFC 6749), grant-discriminated.

Field names use snake_case per OAuth 2.0 specification rather than the project-wide camelCase convention. authorization_code requires code/redirect_uri/client_id/code_verifier; refresh_token (MCP only this round) requires refresh_token/client_id/resource and accepts an optional scope (absent = inherit, explicit = must equal the original set).

client_id?string|null
code?string|null
code_verifier?string|null
grant_type*string
redirect_uri?string|null
refresh_token?string|null
resource?|

RFC 8707 resource indicator. The MCP authorization_code exchange must repeat the code's resource; the refresh grant requires the bound resource.

scope?|

Refresh grant only: absent inherits the original scope set, an explicit value must equal it exactly.

Response Body

Access token issued

application/json
  1. response

OAuth 2.0 token response (RFC 6749)

access_token*string
expires_in*integer
Formatint64
Range0 <= value
id_token?|

OIDC identity token (RS256 JWT). Present only when the authorization request carried the openid scope; omitted otherwise so non-OIDC responses stay byte-identical.

refresh_expires_in*integer
Formatint64
Range0 <= value
refresh_token*string
token_type*string
Example Request
curl -X POST 'https://example.com/api/oauth/string/token' \
  -H 'Content-Type: application/json' \
  -d '{
  "grant_type": "string"
}'
Example Response
{
  "access_token": "string",
  "expires_in": 0,
  "id_token": "string",
  "refresh_expires_in": 0,
  "refresh_token": "string",
  "token_type": "string"
}