NATSoauth.token.introspect内省访问令牌

opaque 令牌的回源校验点;返回令牌有效性、归属用户与 scope。

Request Payload

消息格式:JSON

NameData TypeRequiredDescription
tokenstringYes访问令牌
tokenTypeHintstringNoaccess_token / refresh_token(可选)
type RequestBody = {
  /** 访问令牌 */
  token: string
  /** access_token / refresh_token(可选) */
  tokenTypeHint?: string
}
{
  "token": "at_o_77b2ce14d9f0a358"
}

Response Payload

回复使用统一信封 {id, code, messages, result},其 result:

NameData TypeRequiredDescription
activebooleanYes令牌是否有效
appIdstringNo所属应用 ID
userIdstringNo归属用户 ID
scopesarrayNo令牌的 scope
expiresAtstringNo过期时间
type ResponseBody = {
  /** 令牌是否有效 */
  active: boolean
  /** 所属应用 ID */
  appId?: string
  /** 归属用户 ID */
  userId?: string
  /** 令牌的 scope */
  scopes?: string[]
  /** 过期时间 */
  expiresAt?: string
}
{
  "active": true,
  "appId": "01JD8SNST2N5U6X1BU9YBHK4C7J",
  "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "scopes": [
    "user:profile:read",
    "orgs:list"
  ],
  "expiresAt": "2026-10-14T14:00:00Z"
}

Response Code

回复使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 内省访问令牌

Examples

{ "token": "at_o_77b2ce14d9f0a358" }
{
  "id": "01JD8SWUIT8V5WS",
  "code": 0,
  "messages": [],
  "result": {
    "active": true,
    "appId": "01JD8SNST2N5U6X1BU9YBHK4C7J",
    "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
    "scopes": ["user:profile:read", "orgs:list"],
    "expiresAt": "2026-10-14T14:00:00Z"
  }
}

Remarks

jwt 形态令牌无需内省(资源方经 JWKS 离线校验);传 jwt 串时同样解析返回,供未实现离线校验的接入方使用。