接口文档

所有接口均为 UTF-8,请求体 application/x-www-form-urlencoded,响应 application/json。

POST /oauth/token

支持 authorization_code 与 refresh_token 两种 grant。客户端认证方式:client_secret_basic 或 client_secret_post。

参数说明
grant_typeauthorization_code / refresh_token
code授权码(authorization_code 时必填)
redirect_uri需与授权请求时一致
code_verifierPKCE 原始随机串(发起时用了 code_challenge 则必填)
refresh_token刷新时必填
client_id / client_secret公开客户端只传 client_id

响应头带 Cache-Control: no-store。错误按 RFC 6749 §5.2 返回 error、error_description。

GET /oauth/userinfo

需要 Authorization: Bearer <access_token>。返回该令牌 scope 覆盖的字段,openid 免费。

{
  "openid": "o_7f3a9c...",
  "jintuzi_no": "jintuzi",
  "nickname": "小兔",
  "avatar": "https://api.jintuzi.com/v1/users/u_10000/avatar",
  "gender": "女",
  "region": "贵州 毕节",
  "signature": "…",
  "phone": "130****0000",
  "scope": "user:avatar user:nickname",
  "_billing": {
    "currency": "CNY",
    "charged": "0.02",
    "balance": "19.98",
    "fields": ["avatar", "nickname"]
  }
}

可用 ?fields=nickname,avatar 只取部分字段(必须是该令牌 scope 的子集)。字段值为空时不会出现在响应里,也不计费。

手机号的合规要求

只有用户明确同意 user:phone 后才会返回完整手机号。按《个人信息保护法》要求,你必须在隐私政策中说明用途、保存期限,并提供删除渠道;严禁用于营销外呼或转售。

POST /oauth/revoke

撤销 access_token 或 refresh_token(RFC 7009)。参数:token、client_id、client_secret。成功返回 HTTP 200,无 body。

POST /oauth/introspect

令牌内省(RFC 7662)。参数同上,返回 active、scope、exp、client_id。

服务元数据

GET https://open.jintuzi.com/.well-known/oauth-authorization-server