POST /oauth/introspect
OAuth 2.0 令牌自省端点。检查令牌的活跃状态,返回令牌的元数据(sub, client_id, scope, exp 等)。返回扁平 JSON(无 code/message 信封)。S9-A:端点要求机密客户端认证(RFC 7662 §2.1,Basic / client_secret_post / private_key_jwt)。参考:RFC 7662 (Token Introspection)。
OAuth None application/x-www-form-urlencoded
请求参数
| 名称 | 位置 | 类型 | 必填 | 默认值 | 示例 | 约束 | 描述 |
token |
formData |
string |
是 |
|
|
|
待检查的令牌(access_token 或 refresh_token) |
client_id |
formData |
string |
否 |
|
|
|
客户端ID(client_secret_post / private_key_jwt) |
client_secret |
formData |
string |
否 |
|
|
|
客户端密钥(client_secret_post) |
client_assertion |
formData |
string |
否 |
|
|
|
客户端断言 JWT(private_key_jwt) |
client_assertion_type |
formData |
string |
否 |
|
|
|
断言类型(private_key_jwt) |
引用的 Schema
service-oauth/internal/handler/dto.OAuthErrorResponse
OAuth标准错误响应
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
error |
string |
否 |
invalid_request |
|
错误码 |
error_description |
string |
否 |
Missing required parameter |
|
错误描述 |
error_uri |
string |
否 |
https://docs.example.com/errors |
|
错误URI |
i18n_key |
string |
否 |
error.oauth_invalid_request |
|
I18nKey 本地化键(AUTH-46①/U416):协议字段 error/error_description 保持 RFC 6749 §5.2 原样,
本字段是**附加**信息(omitempty;未知错误码不填),供前端/AI 客户端按键确定性渲染文案,
无需解析英文原文。仅出现在 JSON 错误体,不写入 302 错误重定向的查询串。 |
state |
string |
否 |
state-123 |
|
状态 |
service-oauth/internal/handler/dto.TokenIntrospectionResponse
令牌自检结果
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
active |
boolean |
否 |
True |
|
是否有效 |
aud |
string |
否 |
auth-ms |
|
受众 |
client_id |
string |
否 |
app-123 |
|
客户端ID |
exp |
integer |
否 |
1713187200 |
|
过期时间 |
iat |
integer |
否 |
1713183600 |
|
签发时间 |
scope |
string |
否 |
openid profile |
|
范围 |
sub |
string |
否 |
usr_abc123 |
|
用户ID |
token_type |
string |
否 |
Bearer |
|
令牌类型 |
username |
string |
否 |
user@example.com |
|
用户名 |