Échanger un code d’autorisation, rafraîchir une session ou authentifier un client confidentiel
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" }'Endpoint de jeton OAuth 2.1. grant_type=authorization_code (+ PKCE S256, depuis Se connecter avec Vimine), refresh_token (renouvelé à chaque utilisation ; sa réutilisation révoque la famille de sessions), client_credentials (clients confidentiels, HTTP Basic ou dans le corps). Les erreurs suivent la RFC 6749.
Corps de la requêteobligatoire
Section intitulée « Corps de la requêteobligatoire »Type de médiaapplication/json
object
grant_type
obligatoire
string
client_id
string
client_secret
string
code
string
code_verifier
string
redirect_uri
string format : uri
refresh_token
string
scope
string
Réponses
Section intitulée « Réponses »Réponse de jeton
Type de médiaapplication/json
object
access_token
string
token_type
string
expires_in
integer
refresh_token
string
scope
string
sub
string
Exemplegénéré
{ "access_token": "example", "token_type": "example", "expires_in": 1, "refresh_token": "example", "scope": "example", "sub": "example"}Requête invalide
Type de médiaapplication/problem+json
object
type
obligatoire
string format : uri
title
obligatoire
string
status
obligatoire
integer
detail
string
code
obligatoire
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
Exemplegénéré
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}Introuvable
Type de médiaapplication/problem+json
object
type
obligatoire
string format : uri
title
obligatoire
string
status
obligatoire
integer
detail
string
code
obligatoire
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
Exemplegénéré
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}Limite de débit atteinte
Type de médiaapplication/problem+json
object
type
obligatoire
string format : uri
title
obligatoire
string
status
obligatoire
integer
detail
string
code
obligatoire
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
Exemplegénéré
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}Erreur interne
Type de médiaapplication/problem+json
object
type
obligatoire
string format : uri
title
obligatoire
string
status
obligatoire
integer
detail
string
code
obligatoire
string
request_id
string
errors
Array<object>
object
field
string
code
string
message
string
Exemplegénéré
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "code": "example", "request_id": "example", "errors": [ { "field": "example", "code": "example", "message": "example" } ]}