OAuth
签发访问令牌
client_credentials、authorization_code、refresh_token 可换取 3600 秒有效的令牌。
请求体
application/x-www-form-urlencoded, application/json
grant_typestring必填要交换的授权类型:
client_credentials、authorization_code或refresh_token允许的值:
client_credentialsauthorization_coderefresh_tokenclient_idstring必填客户端应用的标识符
client_secretstring保密客户端的密钥(
client_secret_post),或放在Authorization: Basic标头中(client_secret_basic),不可同时使用;公开客户端无需提供scopestring申请的 scope,以空格分隔;省略则为该授权的全部 scope
workspace_idstring令牌所操作的 Workspace:在
client_credentials下应用有多个时必填,只有一个时可选codestringauthorization_code:在重定向地址收到的授权码code_verifierstringauthorization_code:PKCE 验证码(RFC 7636)redirect_uristringauthorization_code:与授权时相同的重定向地址refresh_tokenstringrefresh_token:刷新令牌,仅可使用一次
响应
200application/json
访问令牌;只有授予了 offline_access 才会包含 refresh_token。
access_tokenstring必填不透明的访问令牌
token_typestring必填始终为
Bearer允许的值:
Bearerexpires_innumber必填有效期,单位为秒
scopestring必填已授予的 scope,以空格分隔
refresh_tokenstring仅限
authorization_code和refresh_token,且已授予offline_access:仅可使用一次,每次交换都会轮换
400
invalid_request、invalid_grant、unsupported_grant_type、invalid_scope 或 unauthorized_client。
401
invalid_client:未知客户端、密钥错误或缺失,或应用已被撤销。