交换授权码、刷新会话,或对机密客户端进行认证
POST
/v1/oauth/token
const url = 'https://api.vimine.network/v1/oauth/token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"grant_type":"authorization_code","client_id":"example","client_secret":"example","code":"example","code_verifier":"example","redirect_uri":"https://example.com","refresh_token":"example","scope":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.vimine.network/v1/oauth/token \ --header 'Content-Type: application/json' \ --data '{ "grant_type": "authorization_code", "client_id": "example", "client_secret": "example", "code": "example", "code_verifier": "example", "redirect_uri": "https://example.com", "refresh_token": "example", "scope": "example" }'OAuth 2.1 令牌端点。grant_type=authorization_code(+ PKCE S256,来自“使用 Vimine 登录”)、refresh_token(轮换;重复使用会撤销整个会话家族)、client_credentials(机密客户端,HTTP Basic 或请求体)。错误遵循 RFC 6749。
请求体必填
章节“请求体必填”媒体类型application/json
object
grant_type
必填
string
client_id
string
client_secret
string
code
string
code_verifier
string
redirect_uri
string 格式: uri
refresh_token
string
scope
string
响应
章节“响应”200
章节“200”令牌响应
媒体类型application/json
object
access_token
string
token_type
string
expires_in
integer
refresh_token
string
scope
string
sub
string
示例自动生成
{ "access_token": "example", "token_type": "example", "expires_in": 1, "refresh_token": "example", "scope": "example", "sub": "example"}400
章节“400”请求无效
媒体类型application/problem+json
object
type
必填
string 格式: uri
title
必填
string
status
必填
integer
detail
string
code
必填
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
示例自动生成
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}404
章节“404”未找到
媒体类型application/problem+json
object
type
必填
string 格式: uri
title
必填
string
status
必填
integer
detail
string
code
必填
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
示例自动生成
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}429
章节“429”已触发速率限制
媒体类型application/problem+json
object
type
必填
string 格式: uri
title
必填
string
status
必填
integer
detail
string
code
必填
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
示例自动生成
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}500
章节“500”内部错误
媒体类型application/problem+json
object
type
必填
string 格式: uri
title
必填
string
status
必填
integer
detail
string
code
必填
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
示例自动生成
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}