{
  "id": "introspect-1",
  "title": "Token Introspect: How do I validate tokens with an OAuth 2.0 introspection endpoint or RFC 8414 discovery?",
  "description": "Two Token Introspect configurations for authorization servers that are not plain OpenID Connect providers: online_oauth2_validation posts an opaque token to an RFC 7662 introspection endpoint with client credentials, and offline_validation.discovery = rfc8414 fetches a JWT issuer's keys from its OAuth 2.0 authorization-server metadata. Shows the create, the read that never returns the client secret, the update that keeps it, and the exact 422 messages.",
  "category": "Token Introspect",
  "tags": [
    "Token Introspect",
    "OAuth 2.0",
    "RFC 7662",
    "RFC 8414",
    "Opaque Token",
    "JWT",
    "Discovery",
    "Config API"
  ],
  "api": "Token Introspect",
  "language": "Json",
  "lastUpdated": "2026-10-28",
  "openApiEndpoints": [
    "/configs/v1/token-introspects",
    "/configs/v1/token-introspects/{id}"
  ],
  "relatedGuides": [
    "/guides/guide-token-introspect",
    "/guides/guide-config-api",
    "/guides/guide-credentials"
  ],
  "commonErrors": [
    {
      "code": "422",
      "message": "invalid field online_oauth2_validation.introspection_endpoint: \"not-url\" does not meet rule http_url",
      "solution": "Send the full https URL of the RFC 7662 introspection endpoint. A plain http URL is refused with introspection endpoint: unsupported URL scheme: must be https, and a host that resolves to a loopback, link-local or private address with introspection endpoint: destination is not permitted."
    },
    {
      "code": "422",
      "message": "missing field online_oauth2_validation.secret_basic.client_id",
      "solution": "secret_basic needs client_id on every create and update, and client_secret on create. On update client_secret may be left out to keep the stored one, unless introspection_endpoint or client_id changes: then the error is online OAuth2 validation requires secret_basic.client_secret, when the introspection endpoint or client_id changes."
    },
    {
      "code": "422",
      "message": "invalid field online_oauth2_validation.cache_ttl: 3601 does not meet rule max=3600",
      "solution": "cache_ttl is in seconds and at most 3600. Leave it out to introspect the token on every request."
    },
    {
      "code": "422",
      "message": "offline_validation should be excluded with onlinevalidation onlineoauth2validation opaquematcher",
      "solution": "Send exactly one validation mode, and never offline_validation with an opaque_matcher: an opaque token can only be validated online, at a userinfo endpoint or at an introspection endpoint."
    },
    {
      "code": "409",
      "message": "token introspect config with the same hint already exists",
      "solution": "Another configuration of the project already uses this opaque_matcher.hint; the same rule applies to a jwt_matcher issuer and audience pair (token introspect config with the same issuer and audience already exists). Update the existing configuration instead."
    }
  ],
  "summary": "A Token Introspect configuration tells the platform how to validate the end-user tokens your application forwards in the Authorization header and which graph node type they stand for. Besides offline validation with OpenID Connect discovery and online validation at a userinfo endpoint, two modes cover authorization servers that follow the OAuth 2.0 RFCs rather than OpenID Connect:\n\n1. online_oauth2_validation - for opaque tokens (and JWTs) issued by a server with an RFC 7662 token introspection endpoint. The platform posts the token to introspection_endpoint with HTTP Basic authentication (client_secret_basic), accepts it only when the response carries \"active\": true, and uses the response's claims as the token's claims. cache_ttl, in seconds and at most 3600, caches a positive result up to the token's exp; without it every request introspects.\n\n2. offline_validation with discovery \"rfc8414\" - for JWTs whose issuer publishes RFC 8414 authorization-server metadata instead of an OpenID document. With no public_jwks pinned, the platform reads jwks_uri from https://<host>/.well-known/oauth-authorization-server/<issuer path>, the well-known suffix inserted between the host and the path of the issuer. The default, \"oidc\", reads <issuer>/.well-known/openid-configuration.\n\nclient_secret is write-only: a read returns secret_basic with client_id only, and an update may leave client_secret out to keep the stored value, unless introspection_endpoint or client_id changes in the same update.",
  "usecase": "Scenario: Your users sign in at an OAuth 2.0 authorization server that issues opaque access tokens and exposes a token introspection endpoint, not a userinfo endpoint. A second tenant of the same server issues JWTs and publishes its metadata under /.well-known/oauth-authorization-server. Both token kinds must resolve to a Person node so that ContX IQ and AuthZEN can act for the signed-in user.\n\nTwo Token Introspect configurations in the project, one per matcher, give each token the validation it needs: the opaque tokens are introspected with the platform's client credentials; the JWTs are verified locally with the keys the RFC 8414 document names. Your application changes nothing: it forwards the user's token as before, and the platform picks the configuration whose matcher fits.",
  "requirements": "Prerequisites:\n- ServiceAccount credentials: Bearer token in the Authorization header for the Config API calls below.\n- A project id (project_id).\n- For the OAuth 2.0 mode: the authorization server's RFC 7662 introspection endpoint over https, and a client id and secret it accepts with HTTP Basic authentication.\n- For the RFC 8414 mode: the issuer value (iss claim) your JWTs carry, over https, and the audience value (aud claim); the server must publish /.well-known/oauth-authorization-server for that issuer.\n\nRequired API access:\n- POST /configs/v1/token-introspects\n- GET /configs/v1/token-introspects/{id}\n- PUT /configs/v1/token-introspects/{id}",
  "steps": "Step 1: Create the OAuth 2.0 introspection configuration\n- Authentication: ServiceAccount credential as Bearer token.\n- Action: POST /configs/v1/token-introspects with opaque_matcher.hint and online_oauth2_validation (introspection_endpoint, secret_basic.client_id and client_secret, optional cache_ttl), plus ikg_node_type.\n- Result: 201 with the configuration id and an etag header. The introspection endpoint is checked when the configuration is saved: a plain http URL, or a host that resolves to a private address, is refused with 422.\n\nStep 2: Read it back\n- Action: GET /configs/v1/token-introspects/{id}.\n- Result: online_oauth2_validation with introspection_endpoint, cache_ttl and secret_basic.client_id; client_secret is never returned, not even as a key. The other validation modes are null.\n\nStep 3: Update without re-sending the secret\n- Action: PUT /configs/v1/token-introspects/{id} with the full configuration again (PUT is a replacement) and secret_basic.client_id only.\n- Result: 200; the stored client_secret is kept because neither introspection_endpoint nor client_id changed. If one of them changes, the body must carry a new client_secret, otherwise 422 with online OAuth2 validation requires secret_basic.client_secret, when the introspection endpoint or client_id changes.\n\nStep 4: Create the RFC 8414 discovery configuration\n- Action: POST /configs/v1/token-introspects with jwt_matcher.issuer and audience, offline_validation.discovery = \"rfc8414\" and ikg_node_type.\n- Result: 201. A read returns offline_validation as {\"public_jwks\": [], \"discovery\": \"rfc8414\"}. Two configurations of one project cannot share an issuer and audience, nor an opaque hint: the second is refused with 409.\n\nStep 5: See the validation messages\n- Action: POST a body with a malformed introspection_endpoint, no client_id and a cache_ttl above 3600.\n- Result: 422 listing one entry per field.",
  "code": [
    {
      "step": "Step 1",
      "description": "Create the OAuth 2.0 introspection configuration. An opaque token carries no claims of its own, so an opaque_matcher needs one of the two online modes; this one posts the token to introspection_endpoint with client_secret_basic. introspection_endpoint must be https and is configured explicitly, there is no discovery for it.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/token-introspects",
      "language": "Json",
      "ingest": {
        "name": "oauth2-token-introspect",
        "display_name": "OAuth 2.0 introspection",
        "description": "Validates opaque tokens at the authorization server's RFC 7662 introspection endpoint",
        "project_id": "gid-of-project",
        "opaque_matcher": {
          "hint": "my.domain.com"
        },
        "online_oauth2_validation": {
          "introspection_endpoint": "https://auth.example.com/oauth2/introspect",
          "secret_basic": {
            "client_id": "indykite-introspector",
            "client_secret": "<client-secret-issued-by-your-authorization-server>"
          },
          "cache_ttl": 300
        },
        "ikg_node_type": "Person",
        "perform_upsert": true
      }
    },
    {
      "step": "Step 2",
      "description": "Read the configuration back. secret_basic carries client_id only: the client secret is write-only and never returned.",
      "filename": "GET https://eu.api.indykite.com/configs/v1/token-introspects/{id}",
      "language": "Json",
      "code": "\nHTTP/2 200\netag: \"a1b2c3\"\n\n{\n  \"id\": \"gid-of-token-introspect\",\n  \"name\": \"oauth2-token-introspect\",\n  \"display_name\": \"OAuth 2.0 introspection\",\n  \"description\": \"Validates opaque tokens at the authorization server's RFC 7662 introspection endpoint\",\n  \"project_id\": \"gid-of-project\",\n  \"jwt_matcher\": null,\n  \"opaque_matcher\": {\n    \"hint\": \"my.domain.com\"\n  },\n  \"offline_validation\": null,\n  \"online_validation\": null,\n  \"online_oauth2_validation\": {\n    \"introspection_endpoint\": \"https://auth.example.com/oauth2/introspect\",\n    \"secret_basic\": {\n      \"client_id\": \"indykite-introspector\"\n    },\n    \"cache_ttl\": 300\n  },\n  \"ikg_node_type\": \"Person\",\n  \"perform_upsert\": true,\n  \"create_time\": \"2026-10-28T09:12:44Z\",\n  \"update_time\": \"2026-10-28T09:12:44Z\"\n}"
    },
    {
      "step": "Step 3",
      "description": "Replace the configuration with a longer cache_ttl. client_secret is left out and the stored value is kept, because introspection_endpoint and client_id are unchanged. Send the etag from Step 2 as If-Match to get 412 instead of overwriting a concurrent change.",
      "filename": "PUT https://eu.api.indykite.com/configs/v1/token-introspects/{id}",
      "language": "Json",
      "ingest": {
        "opaque_matcher": {
          "hint": "my.domain.com"
        },
        "online_oauth2_validation": {
          "introspection_endpoint": "https://auth.example.com/oauth2/introspect",
          "secret_basic": {
            "client_id": "indykite-introspector"
          },
          "cache_ttl": 600
        },
        "ikg_node_type": "Person",
        "perform_upsert": true
      }
    },
    {
      "step": "Step 4",
      "description": "Create the RFC 8414 discovery configuration for a JWT issuer. With no public_jwks, discovery selects the metadata document that names jwks_uri: \"rfc8414\" reads https://auth.example.com/.well-known/oauth-authorization-server/tenant-a for this issuer. Leave discovery out, or set \"oidc\", for an OpenID Connect issuer.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/token-introspects",
      "language": "Json",
      "ingest": {
        "name": "rfc8414-token-introspect",
        "display_name": "RFC 8414 discovery",
        "description": "Validates JWTs with the keys published by the issuer's OAuth 2.0 authorization server metadata",
        "project_id": "gid-of-project",
        "jwt_matcher": {
          "issuer": "https://auth.example.com/tenant-a",
          "audience": "client-id-of-your-app"
        },
        "offline_validation": {
          "discovery": "rfc8414"
        },
        "ikg_node_type": "Person",
        "perform_upsert": true
      }
    },
    {
      "description": "The read of that configuration: discovery is returned next to an empty public_jwks list.",
      "filename": "GET https://eu.api.indykite.com/configs/v1/token-introspects/{id}",
      "language": "Json",
      "code": "\nHTTP/2 200\netag: \"d4e5f6\"\n\n{\n  \"id\": \"gid-of-token-introspect\",\n  \"name\": \"rfc8414-token-introspect\",\n  \"display_name\": \"RFC 8414 discovery\",\n  \"description\": \"Validates JWTs with the keys published by the issuer's OAuth 2.0 authorization server metadata\",\n  \"project_id\": \"gid-of-project\",\n  \"jwt_matcher\": {\n    \"issuer\": \"https://auth.example.com/tenant-a\",\n    \"audience\": \"client-id-of-your-app\"\n  },\n  \"opaque_matcher\": null,\n  \"offline_validation\": {\n    \"public_jwks\": [],\n    \"discovery\": \"rfc8414\"\n  },\n  \"online_validation\": null,\n  \"online_oauth2_validation\": null,\n  \"ikg_node_type\": \"Person\",\n  \"perform_upsert\": true,\n  \"create_time\": \"2026-10-28T09:14:02Z\",\n  \"update_time\": \"2026-10-28T09:14:02Z\"\n}"
    },
    {
      "step": "Step 5",
      "description": "A body that breaks three rules at once: introspection_endpoint is not a URL, secret_basic has no client_id, and cache_ttl exceeds 3600.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/token-introspects",
      "language": "Json",
      "ingest": {
        "name": "oauth2-token-introspect-broken",
        "project_id": "gid-of-project",
        "opaque_matcher": {
          "hint": "another.domain.com"
        },
        "online_oauth2_validation": {
          "introspection_endpoint": "not-url",
          "secret_basic": {
            "client_secret": "<client-secret>"
          },
          "cache_ttl": 3601
        },
        "ikg_node_type": "Person"
      }
    },
    {
      "description": "422: one entry per failed rule.",
      "language": "Json",
      "code": "\nHTTP/2 422\n\n{\n  \"message\": \"Unprocessable Entity\",\n  \"errors\": [\n    \"invalid field online_oauth2_validation.introspection_endpoint: \\\"not-url\\\" does not meet rule http_url\",\n    \"missing field online_oauth2_validation.secret_basic.client_id\",\n    \"invalid field online_oauth2_validation.cache_ttl: 3601 does not meet rule max=3600\"\n  ]\n}"
    }
  ],
  "links": {
    "html": "/resources/introspect-1",
    "markdown": "/resources/introspect-1.md",
    "openApi": "https://openapi.indykite.com/"
  }
}