{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/riskmodels-app/json-schema/riskmodels-app-oauth2-token-request-schema.json",
  "title": "OAuth2TokenRequest",
  "description": "Shape depends on `grant_type`. For `authorization_code`: `code`, `redirect_uri`, `client_id`, `code_verifier` are all required. For `refresh_token`: `refresh_token` and `client_id` are required.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/riskmodels-app-authentication-api-openapi.yml#/components/schemas/OAuth2TokenRequest",
  "type": "object",
  "required": [
    "grant_type"
  ],
  "properties": {
    "grant_type": {
      "type": "string",
      "enum": [
        "authorization_code",
        "refresh_token"
      ],
      "description": "`client_credentials` is not supported and returns `unsupported_grant_type`.\n"
    },
    "code": {
      "type": "string",
      "description": "Single-use authorization code (authorization_code grant)."
    },
    "redirect_uri": {
      "type": "string",
      "format": "uri",
      "description": "Must match the URI the code was issued for (authorization_code grant)."
    },
    "client_id": {
      "type": "string",
      "format": "uuid",
      "description": "Client id from `POST /api/oauth/register`."
    },
    "code_verifier": {
      "type": "string",
      "description": "PKCE verifier; must hash (S256) to the registered code_challenge."
    },
    "refresh_token": {
      "type": "string",
      "description": "Rotating refresh token (refresh_token grant)."
    }
  }
}