OAuthAuthorizationService.IntrospectToken
内省 Token
查询 token 的有效性与元数据(RFC 7662)。
Authentication
无需鉴权
该接口为公共接口,可直接调用;如携带 OAuth 2.0 access_token 或 API Key 也不会被拒绝。
Request body · IntrospectTokenRequest
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
token | string | — | — |
token_type_hint | string | — | — |
client_id | string | — | — |
client_secret | string | — | — |
include_profile | boolean | — | 可选。设为 true 时,响应会在 profile 字段中一次性返回 token 关联用户的标准 OIDC claims(name / email / phone_number / picture / updated_at),免去再次调用获取用户档案接口。默认 false,与旧行为一致。 仅当 token 处于 active 且关联到具体用户时 profile 才会被填充;对于 client_credentials 等不绑定用户的 token,本参数被忽略,profil… |
Response
200 OK · IntrospectTokenResponse
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
active | boolean | — | — |
scope | string | — | — |
client_id | string | — | — |
user_id | string | — | 对 client_credentials token 为空 |
token_type | string | — | — |
expires_at | Timestamp | — | — |
issued_at | Timestamp | — | — |
profile(nullable) | UserProfile | — | 仅当请求 include_profile=true 且 token 关联 user_id 时填充。OIDC userinfo 标准 claims 子集——字段对齐 OIDC Core 1.0 §5.4。 注意:本字段不是 access_token 的合法承载——客户端不应把 IntrospectTokenResponse 序列化后塞进 Authorization 头。该字段适合直接序列化为 JSON 用作 /oauth2/userinfo 端点的响应。 |
错误响应 · google.rpc.Status
非 2xx 响应均按 AIP-193 规范包装为google.rpc.Status,含 code /message /details 三段。details[].reason 是机器可读的具体错误原因码,可用于客户端分支处理。
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
code | integer (int32) | — | The status code, which should be an enum value of google.rpc.Code. |
message | string | — | A developer-facing error message. |
details | array<Any> | — | A list of messages that carry the error details. |
Examples
curl -X POST \
'https://api.appforges.com/v1/oauth/introspect' \
-H 'Authorization: Bearer $ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"token": "string",
"token_type_hint": "string",
"client_id": "string",
"client_secret": "string",
"include_profile": false
}'OpenAPI spec v0.59.4 · synced 10/11/2026, 11:27:14 PM