What is Token Introspection?
Token introspection is the process through which a resource server validates an access or refresh token by querying the authorization server, typically via an introspection endpoint.
This yields metadata (claims) about the token such as subject (sub), scopes, issuer, and expiration.
Standardized by OAuth 2.0 Token Introspection (RFC 7662), introspection is critical for validating opaque tokens and can also play a role in managing JWTs across distributed systems.
What token types does IndyKite support?
Opaque Tokens
What are opaque tokens?
- Random strings with no readable structure.
- Must be validated online via
/introspector/userinfoendpoints. - Commonly issued by providers like Okta, Auth0, Keycloak.
- Enable centralized revocation and token lifecycle management.
How does opaque token validation work?
- Client sends the token to a resource server.
- The resource server sends a POST request to the introspection endpoint:
POST /introspect Authorization: Basic base64(client_id:client_secret) Content-Type: application/x-www-form-urlencoded token=ACCESS_TOKEN
- The authorization server returns JSON describing the token:
{ "active": true, "scope": "read write", "client_id": "client123", "username": "alice", "sub": "user123", ... }
- The resource server uses the returned claims for authorization and access control decisions.
JWT Tokens (JSON Web Tokens)
What are JWT tokens?
- Self-contained, signed tokens that include structured claims.
- Can be validated offline, without contacting the issuer, by:
- Decoding the payload.
- Verifying the signature using a public key (via JWKS or
.well-known).
- Use introspection optionally for:
- Claim enrichment.
- Additional validation logic or identity mapping.
How does JWT validation work?
- Receives the JWT (e.g., via
Authorization: Bearer ...header).
- Decodes the token (Base64) to inspect claims.
- Verifies the signature using:
- A public key (RS256) from the issuer's JWKS endpoint.
- Or a shared secret (HS256).
- Uses verified claims (
sub,exp,scope,aud, etc.) to enforce access policies.
Introspection endpoints are not necessary for JWTs when the token can be fully validated offline.
How does IndyKite handle third-party tokens?
IndyKite APIs can identify users via third-party tokens through token introspection configuration. This configuration enables the IndyKite platform to validate these tokens and utilize their content.
Step 1: How do I configure token validation?
The configuration specifies how to validate the token. You can choose between:
JWT (Offline Validation)
Validate the signature locally, with public keys you pin in public_jwks or with the keys at the issuer's jwks_uri. Without pinned keys, discovery selects the metadata document that names that URI: oidc (the default) reads https://<issuer>/.well-known/openid-configuration; rfc8414 reads the RFC 8414 document https://<issuer host>/.well-known/oauth-authorization-server/<issuer path>, the suffix inserted between the host and the path of the issuer. With pinned keys discovery is not used and stays empty unless set.
Terraform example:
resource "indykite_token_introspect" "token_config" {
name = "terraform-token-introspect"
display_name = "Terraform token introspect"
description = "Token introspect for User access token"
project_id = "ProjectGID"
jwt_matcher { -> JWT specifies all attributes to match with received token.
issuer = "https://xx.xx.auth0.com/" -> Issuer is used to exact match based on iss claim in JWT.
audience = "client-id" -> Audience is used to exact match based on aud claim in JWT
}
offline_validation {} -> Offline validation works only with JWT. If public_jwks is empty, will be generated
ikg_node_type = "Person" -> Node type in IKG to which we will try to match sub claim with DT external_id.
claims_mapping = { -> ClaimsMapping specifies which claims from the token should be mapped to IKG Property with given name.
"email" = "email"
"phone_number" = "phone_number"
}
perform_upsert = true -> Perform Upsert specify, if we should create and/or update Identity node in IKG if it doesn't exist with.
}
REST example, the same configuration as a POST /configs/v1/token-introspects body with a Service Account Bearer token. Note the REST shapes: project_id for the project, and each claims_mapping value as an object with a selector:
{
"name": "jwt-token-introspect",
"display_name": "JWT token introspect",
"description": "Token introspect for user access tokens",
"project_id": "gid-of-project",
"jwt_matcher": {
"issuer": "https://xx.xx.auth0.com/",
"audience": "client-id"
},
"offline_validation": {},
"ikg_node_type": "Person",
"claims_mapping": {
"email": { "selector": "email" },
"phone_number": { "selector": "phone_number" }
},
"perform_upsert": true
}
The same body for an authorization server that publishes RFC 8414 metadata instead of an OpenID document: only offline_validation changes. A read returns it as {"public_jwks": [], "discovery": "rfc8414"}.
"offline_validation": { "discovery": "rfc8414" },
Opaque (Online Validation)
Two online modes exist, and an opaque token needs one of them: online_validation calls the issuer's userinfo endpoint; online_oauth2_validation (below) calls an RFC 7662 token introspection endpoint with client credentials. Both also accept JWTs.
Terraform example:
resource "indykite_token_introspect" "token_config" {
name = "terraform-token-introspect"
display_name = "Terraform token introspect"
description = "Token introspect for User access token"
project_id = "ProjectGID"
opaque_matcher { -> Opaque specifies the configuration is for opaque tokens.
hint = "my.domain.com"
}
online_validation {
user_info_endpoint = "https://example.com/userinfo" -> URI of userinfo endpoint which will be used to validate access token and also fetch user claims when opaque token is received. It can remain empty, if JWT token matcher is used
cache_ttl = 600 -> Cache TTL of token validity can be used to minimize calls to userinfo endpoint. If not set, token will not be cached and call to userinfo endpoint will be made on every request
}
ikg_node_type = "Person" -> Node type in IKG to which we will try to match sub claim with identity node external_id.
claims_mapping = { -> ClaimsMapping specifies which claims from the token should be mapped to IKG Property with given name.
"email" = "email"
"phone_number" = "phone_number"
}
perform_upsert = true -> Perform Upsert specify, if we should create and/or update Identity node in IKG if it doesn't exist with.
}
REST example, the same configuration as a POST /configs/v1/token-introspects body. The REST field is userinfo_endpoint, where the Terraform argument is user_info_endpoint:
{
"name": "opaque-token-introspect",
"display_name": "Opaque token introspect",
"description": "Token introspect for opaque access tokens",
"project_id": "gid-of-project",
"opaque_matcher": {
"hint": "my.domain.com"
},
"online_validation": {
"userinfo_endpoint": "https://example.com/userinfo",
"cache_ttl": 600
},
"ikg_node_type": "Person",
"claims_mapping": {
"email": { "selector": "email" },
"phone_number": { "selector": "phone_number" }
},
"perform_upsert": true
}
Opaque (OAuth 2.0 Token Introspection, RFC 7662)
For an authorization server that exposes an introspection endpoint rather than userinfo. The platform posts the token to introspection_endpoint with HTTP Basic authentication (client_secret_basic) and accepts the token only when the response carries "active": true; the response's claims are the token's claims. The endpoint is always configured explicitly, there is no discovery for it. REST example:
{
"name": "oauth2-token-introspect",
"project_id": "gid-of-project",
"opaque_matcher": {
"hint": "my.domain.com"
},
"online_oauth2_validation": {
"introspection_endpoint": "https://example.com/introspect",
"secret_basic": {
"client_id": "your-client",
"client_secret": "<your-client-secret>"
},
"cache_ttl": 300
},
"ikg_node_type": "Person"
}
client_secret is write-only: a read returns "secret_basic": {"client_id": "my-client"} and never the secret, not even its key. It is required on create. On update it may be left out, and the stored value is kept, unless introspection_endpoint or client_id changes in the same update, in which case a new secret is required. Response (201 Created): the same five fields and etag header as every Config API create.
What do the configuration fields mean?
| Field | Description |
|---|---|
jwt_matcher.issuer |
Exact match for the iss claim in the JWT. Must be an https URL on a public host, since the issuer's discovery document and keys are fetched from it; plain http is refused with 422 |
jwt_matcher.audience |
Exact match for the aud claim in the JWT |
opaque_matcher.hint |
Domain hint for opaque token identification |
offline_validation |
Use for JWT tokens; validates the signature locally with public_jwks (up to 10 keys) or with the issuer's published keys. |
offline_validation.discovery |
oidc or rfc8414: the metadata document that names the issuer's jwks_uri when public_jwks is empty. Not set: oidc. Ignored, and returned empty, when keys are pinned. |
online_validation.userinfo_endpoint(Terraform: user_info_endpoint) |
Endpoint to validate opaque tokens and fetch claims; opaque tokens require it. Must be an https URL on a public host; plain http is refused with 422. May stay empty with a jwt_matcher: the userinfo_endpoint of the issuer's .well-known/openid-configuration is used then. |
online_validation.cache_ttl |
Seconds to cache token validity (reduces endpoint calls). At most 3600; the effective TTL is the lower of this value and the token's exp. Not set: no caching, the endpoint is called on every request. An expired JWT is rejected without calling the endpoint. |
online_oauth2_validation.introspection_endpoint |
URI of the RFC 7662 introspection endpoint, required. An invalid URL is refused with 422 and does not meet rule http_url. No discovery. |
online_oauth2_validation.secret_basic.client_id |
Client id for HTTP Basic authentication at the endpoint, required, 1 to 256 characters. |
online_oauth2_validation.secret_basic.client_secret |
Client secret, 1 to 1024 characters. Write-only, never returned. Required on create; omitted on update, the stored value is kept unless the endpoint or client id changes. |
online_oauth2_validation.cache_ttl |
Same rules as online_validation.cache_ttl: at most 3600 seconds, capped by the token's exp, no caching when unset, expired JWTs rejected without a call. |
sub_claim |
The top-level claim to use as the subject instead of sub; whichever is used is also mapped to external_id. REST: {"selector": "user_id"}; Terraform: sub_claim = "user_id". Not set: sub. |
ikg_node_type |
Node type in IKG to match with token subject (e.g., Person). Required when the project uses IKG schema v1; optional with v2 (see What differs between IKG schema v1 and v2?). |
id_key |
Name of the node property that holds the subject claim (sub, or the claim named in sub_claim). Required when the project uses IKG schema v2, ignored with v1. At most 256 characters; no backtick, backslash or control character. REST only; the Terraform provider has no argument for it yet. |
label |
Label of the node in IKG that token introspect matches, and creates with perform_upsert. Required when the project uses IKG schema v2, ignored with v1. At most 256 characters; no backtick, backslash or control character. REST only; the Terraform provider has no argument for it yet. |
claims_mapping |
Map token claims to IKG property names. The rule for a key depends on the project's IKG schema version (see below). |
perform_upsert |
If true, creates/updates identity node in IKG when not found |
Step 2: How does subject mapping work?
After validating the token, IndyKite matches the token subject to an identity node in the IKG.
What information is needed for matching?
- Subject claim: Usually the
subclaim from the third-party IDP, which equalsexternal_idin the IKG.You can also use a different claim to identify the subject: set
sub_claimto{"selector": "user_id"}(REST) orsub_claim = "user_id"(Terraform), and that claim is matched againstexternal_idand mapped to it, in place ofsub.Important: Never use
external_idas aclaims_mappingkey—it's used for matching. - Node type: Specified in the configuration via
ikg_node_type. Required becauseexternal_idis only unique per node type, not across the entire IKG. - With IKG schema
v2: the node is identified bylabeland by the property named inid_key, which holds the subject claim; both are required andikg_node_typebecomes optional. The version is a property of the project (ikg_schema_version), see What differs between IKG schema v1 and v2?.
How do I check what a token resolves to? Call GET /contx-iq/v1/whoami with the AppAgent credential and the user token. It returns exactly the two values the mapping produced - type (the ikg_node_type) and id (the subject claim, equal to the node's external_id) - and nothing else from the token. See the ContX IQ guide and resource ciq-24.
Step 3: How does claims mapping work?
The claims_mapping attribute specifies which claims from the token should be mapped to IKG property names.
- Key: The new claim name and IKG property name.
- Max length: 256 characters
- Pattern:
^[a-zA-Z_][a-zA-Z0-9_]+$when the project uses IKG schemav1 - With IKG schema
v2: 1 to 256 characters, with no backtick, backslash or control character; no other pattern applies
- Value: The token claim to map from.
Which claims are supported?
All standard claims from the OpenID specification are supported. Mapping will fail if claim and data type do not match the standard. For non-standard claims, the type is derived from the JSON.
Warning: Claims mapping can override existing claims, which may affect internal services.
Step 4: What is Just-In-Time (JIT) provisioning?
When perform_upsert = true, IndyKite supports Just-In-Time provisioning: automatically creating or updating an identity node in the IKG based on token claims.
How does JIT provisioning work?
- When a user accesses the system for the first time, their identity node is created on-demand using token attributes.
- The user is granted access immediately based on their new local identity.
Important: For performance reasons, if a created identity node is deleted, token introspection will not create a new node with the same token. A new token must be generated.
What configuration options are available?
| Option | JWT | Opaque |
|---|---|---|
| Issuer | Required | Not used |
| Audience (client_id) | Required | Not used |
| Public Key (JWKS) | Used for signature verification | Not used |
| User Info / Introspect Endpoint | Optional for Offline / Required for Online | Required |
| Caching | JWKS & claims caching | Token metadata caching |
| Validation Method | Offline or Online | Online only |
What claims are commonly used?
| Claim | Description |
|---|---|
sub |
Subject (user ID) of the token |
username |
Login name of the user |
email |
Email of the user |
client_id |
OAuth client that obtained the token |
exp, iat |
Expiration and issued-at timestamps |
scope |
Space-separated list of access scopes |
aud |
Intended audience(s) |
iss |
Issuer of the token |
jti |
Unique token identifier |
roles, permissions |
Optional claims for access control |
acr |
Authentication Context Class Reference (used for step-up authentication) |
What features does IndyKite Token Introspect support?
| Feature | Supported |
|---|---|
| JWT introspection | Yes |
| Opaque token introspection | Yes (Online) |
| Third-party token exchange | Yes |
| Public key & metadata caching | Yes |
| Multi-IDP support | Yes |
| Claims mapping | Yes (Configurable) |
| Just-In-Time provisioning (node upsert into IKG) | Yes (Optional) |
What differs between IKG schema v1 and v2?
Every project carries an IKG schema version, ikg_schema_version: v1 (the default) or v2. It is chosen when the project is created (POST /configs/v1/projects, or the ikg_schema_version argument of indykite_application_space in Terraform), is returned by every read of the project, and cannot be changed afterwards. Today v2 cannot be selected: a create with it is refused with 422 and unsupported ikg_schema_version: only V1 can be set, so every existing project is v1. The version decides how a Token Introspect configuration names the node a token resolves to, and the Config API validates a POST or PUT on /configs/v1/token-introspects against the version of the project it belongs to. No other request or response shape differs between the two versions.
IKG schema v1 |
IKG schema v2 |
|
|---|---|---|
| Availability | Default; the version of every project today. | Refused on project create with 422, unsupported ikg_schema_version: only V1 can be set. |
| Node the token resolves to | The node of type ikg_node_type whose external_id equals the subject claim (sub, or sub_claim). |
The node with the label label whose property id_key equals the subject claim. With perform_upsert the node is created with that label. |
| Required subject fields | ikg_node_type. id_key and label are ignored. |
id_key and label. ikg_node_type is optional. |
ikg_node_type format |
2 to 64 characters matching ^([A-Z][a-z]+)+$. |
Same format when sent. |
id_key and label format |
At most 256 characters; not validated further, since ignored. | 1 to 256 characters, with no backtick, backslash or control character. |
claims_mapping keys |
1 to 256 characters matching ^[a-zA-Z_][a-zA-Z0-9_]+$. |
1 to 256 characters, with no backtick, backslash or control character. |
422 messages specific to the version |
ikg_node_type is required with IKG schema V1claims_mapping key must match ^[a-zA-Z_][a-zA-Z0-9_]+$ with IKG schema V1: "user-id" |
id_key is required with IKG schema V2label is required with IKG schema V2id_key must not contain a backtick, a backslash or a control character (the same for label)claims_mapping key "user`id" must not contain a backtick, a backslash or a control character |
| Read response | ikg_node_type is always returned; id_key and label appear only when they were set. |
Same shape: id_key and label are present, ikg_node_type is returned as an empty string when it was not sent. |
Terraform (indykite_token_introspect) |
ikg_node_type argument. |
id_key and label arguments, required together, in place of ikg_node_type. |
The length limits on id_key and label are checked whatever the version: invalid field id_key: "…" does not meet rule max=256, invalid field label: "…" does not meet rule max=256. The version-specific checks run after the matcher and validation rules, so a body that fails those lists only those messages.
How do I manage a Token Introspect configuration over its lifecycle?
The configuration is a Config API object under /configs/v1/token-introspects, managed with a Service Account token. The rules shared by every Config API resource (list filters, reads by name or version, ETags, the error bodies) are in the Config API conventions guide; what is specific to this resource:
| Operation | Specific to Token Introspect |
|---|---|
POST /configs/v1/token-introspects | Exactly one matcher (jwt_matcher or opaque_matcher) and one validation (offline_validation, JWT only; online_validation; or online_oauth2_validation; an opaque matcher needs one of the two online modes), plus ikg_node_type when the project uses IKG schema v1, or id_key and label with v2 (see What differs between IKG schema v1 and v2?). Two configurations of one project cannot share a jwt_matcher issuer and audience, nor an opaque_matcher.hint: the second is refused with 409 and token introspect config with the same issuer and audience already exists or token introspect config with the same hint already exists. A trailing slash on the issuer is ignored for this comparison. |
GET /configs/v1/token-introspects?project_id=… | Without full_fetch=true each item carries its identifiers, names and timestamps only: the matcher, validation, claims_mapping and sub_claim are null, ikg_node_type is empty and perform_upsert is false. |
GET /configs/v1/token-introspects/{id} | By GID, or by name with ?project_id=. The full configuration, with the etag header to use on the next write. |
PUT /configs/v1/token-introspects/{id} | A full replacement: send ikg_node_type (or id_key and label on a schema v2 project), one matcher and one validation again, with whatever else changes; an empty body is refused with 422 listing the matcher and validation requirements, and a body that passes them without the subject fields of the project's schema version is refused with ikg_node_type is required with IKG schema V1, or id_key is required with IKG schema V2 and label is required with IKG schema V2. The matcher type may change, from JWT to opaque or back, and so may the validation mode. An online_oauth2_validation update may omit client_secret to keep the stored one. The same 409 rules as on create apply. Send the etag as If-Match to get 412 instead of overwriting a concurrent change. |
DELETE /configs/v1/token-introspects/{id} | Returns the deleted id. Tokens of that issuer and audience, or carrying that hint, are no longer validated by the project. While an MCP server configuration references it in token_introspect_id, the delete is refused with 412 and this config node is used by others and cannot be deleted: point that configuration at another Token Introspect, or delete it, first. |
Field-level validation messages you may meet on create and update, all as entries of the 422 body: missing field jwt_matcher.issuer, missing field jwt_matcher.audience, missing field opaque_matcher.hint, online_validation is required with opaquematcher, offline_validation is required without all of onlinevalidation onlineoauth2validation (and the same line for each of the other two modes, when no validation is sent), offline_validation should be excluded with onlinevalidation onlineoauth2validation opaquematcher, invalid field online_oauth2_validation.introspection_endpoint: "not-url" does not meet rule http_url, missing field online_oauth2_validation.secret_basic.client_id, invalid field online_oauth2_validation.cache_ttl: 3601 does not meet rule max=3600, invalid field ikg_node_type: does not match regex "^(?:[A-Z][a-z]+)+$", ikg_node_type is required with IKG schema V1, claims_mapping key must match ^[a-zA-Z_][a-zA-Z0-9_]+$ with IKG schema V1: "user-id", invalid field id_key: "…" does not meet rule max=256, invalid field label: "…" does not meet rule max=256 (and, on a schema v2 project, the messages listed under What differs between IKG schema v1 and v2?), missing field claims_mapping[<key>].selector, missing field sub_claim.selector, issuer: unsupported URL scheme: must be https, userinfo endpoint: unsupported URL scheme: must be https, and issuer: destination is not permitted or userinfo endpoint: destination is not permitted for a literal loopback, link-local or private address.
Next Steps
- Terraform examples: Token Introspect Terraform Configuration
- REST API: Config API Documentation
- Full examples: Developer Hub Resources
- Credentials guide: Credentials Guide
- Token validation in an agent chain, on the reference diagram: Agent Gateway architecture guide