令牌验证
GET /api/token-info
验证 Access Token 的有效性。类似 OAuth 2.0 Token Introspection (RFC 7662)。
频率限制
- 30 次/分钟(基于请求方 IP,非服务器全局限制)
请求
GET https://id.caellab.com/api/token-info
Authorization: Bearer ACCESS_TOKEN
也支持查询参数:
GET https://id.caellab.com/api/token-info?access_token=ACCESS_TOKEN
Token 有效(200)
{
"active": true,
"client_id": "app_abc123def456...",
"user_id": 4,
"scopes": "openid profile",
"expires": 1719657600
}
| 字段 | 类型 | 说明 |
|---|---|---|
active | boolean | Token 是否有效 |
client_id | string | 关联的应用 Client ID |
user_id | integer | 用户内部 ID |
scopes | string | 授权的权限范围 |
expires | integer | 过期时间(Unix 时间戳) |
Token 无效(200)
{
"active": false
}
信息
即使 Token 无效也返回 HTTP 200,通过 active 字段判断有效性。
缺少 Token(400)
{
"error": "invalid_request",
"error_description": "缺少访问令牌"
}
频率限制(429)
{
"error": "rate_limited",
"error_description": "请 求太频繁,请稍后重试"
}