开放平台

交换、刷新令牌或签发机器人令牌

POST /v1/oauth2/token
POST/v1/oauth2/token
下载规范

Confidential client 使用 HTTP Basic 或请求体 client_id/client_secret,二者不可同时使用;不接受 Cookie。body 支持 form-urlencoded 或全字符串 JSON,最大 16KiB,重复字段拒绝。授权码交换必须提交 S256 code_verifier;刷新令牌轮换,重放撤销整族。 绑定机器人的审核应用可使用 client_credentials 申请短期机器人 access token;该 grant 不签发 refresh token。

客户端凭据(HTTP Basic 或请求体)

请求体 必填

bodyobject

方案 1 · object

client_idstring可选
client_secretstring可选
grant_typestring必填
可选值"authorization_code"
codestring必填
redirect_uristring必填

格式:uri

code_verifierstring必填

格式:^[A-Za-z0-9._~-]{43,128}$

方案 2 · object

client_idstring可选
client_secretstring可选
grant_typestring必填
可选值"refresh_token"
refresh_tokenstring必填
scopestring可选

方案 3 · object

client_idstring可选
client_secretstring可选
grant_typestring必填
可选值"client_credentials"
scopestring可选

返回值

成功

access_tokenstring必填
token_typestring必填
可选值"Bearer"
expires_ininteger必填
refresh_tokenstring可选
scopestring必填
接口信息

接口: POST /v1/oauth2/token
operationId: exchangeOAuthToken

Confidential client 使用 HTTP Basic 或请求体 client_id/client_secret,二者不可同时使用;不接受 Cookie。body 支持 form-urlencoded 或全字符串 JSON,最大 16KiB,重复字段拒绝。授权码交换必须提交 S256 code_verifier;刷新令牌轮换,重放撤销整族。 绑定机器人的审核应用可使用 client_credentials 申请短期机器人 access token;该 grant 不签发 refresh token。

参数:

  • body client_id
  • body client_secret
  • body grant_type
  • body code
  • body redirect_uri
  • body code_verifier
  • body refresh_token
  • body scope