Skip to main content
服务账号令牌

吊销 Service Account Token

立即吊销一个已签发的 Service Account Token。
POST /api/v1/forward/service_account_tokens/{auth_token_id}/revoke 吊销后该 Token 立即失效,后续携带它的业务请求会被拒绝。适用于 Token 疑似泄露、终端用户会话提前结束等场景。

请求头

Header是否必填说明
AuthorizationBearer <Service Account Key>
Content-Typeapplication/json

路径参数

参数类型是否必填说明
auth_token_idstring要吊销的 Token 唯一标识,即创建 Token 响应中的 auth_token_id

请求体参数

参数类型是否必填说明
target_credential_idstring目标 Token 的签发 Key ID(创建响应中的 credential_id),用于精确定位。
target_expires_atstring目标 Token 的过期时间,RFC 3339 格式(创建响应中的 expires_at),用于精确定位。
reasonstring吊销原因,便于审计追踪。

示例请求

curl -s -X POST 'https://api.qoder.com/api/v1/forward/service_account_tokens/3f8a2b1c-6d4e-4f2a-9b7c-1e5d8a0c4b2f/revoke' \
  -H "Authorization: Bearer $QODER_SA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "suspected_leak"
}'

示例响应

HTTP 200 OK
{
  "revoked": true
}

响应字段

字段类型说明
revokedboolean是否吊销成功,固定为 true

错误

HTTPTypeCode触发条件
400invalid_request_error-请求体不合法,或 target_expires_at 不是合法的 RFC 3339 时间。
401authentication_error-Service Account Key 无效、已过期,或使用了其他类型的凭证。
404not_found_error-目标 Token 不存在或不属于当前 Service Account。
409conflict_error-定位条件命中多个 Token;请补充 target_credential_idtarget_expires_at 精确定位。

备注

  • 吊销操作不可撤销;如需继续访问,请重新创建 Token。
  • 只能吊销同一 Service Account 名下签发的 Token。
  • 疑似 Key 泄露时,除吊销 Token 外,请同时在 Qoder 控制台 企业凭证 页面轮换 Service Account Key。

相关

吊销 Service Account Token - Qoder