Client Credential Flow
Este endpoint permite generar access token para acceder a los servicios de trust, se requiere un client_id y un client_secret. El token retornado tiene un tiempo de expiracion indicado en la suma de created_at + expires_in.
Endpoint
Headers
Key | Value | Description |
---|---|---|
Content-Type | application/json |
Url
Method: POST
URL: https://atenea.trust.lat/oauth/token/
Body
{
"client_id": "1111-2222-3333-4444",
"client_secret": "aaaa-bbbb-cccc-dddd",
"grant_type": "client_credentials"
}
Code examples
- Curl
- JavaScript
- Java
- Python
curl --location --request POST 'https://atenea.trust.lat/oauth/token/' \
--header 'Content-Type: application/json' \
--data-raw '{
"client_id": "1111-2222-3333-4444",
"client_secret": "aaaa-bbbb-cccc-dddd",
"grant_type": "client_credentials"
}'
import requests
url = "https://atenea.trust.lat/oauth/token/"
payload = "{\n\t\"client_id\": \"1111-2222-3333-4444\",\n\t\"client_secret\": \"aaaa-bbbb-cccc-dddd\",\n\t\"grant_type\": \"client_credentials\"\n}"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"client_id\": \"1111-2222-3333-4444\",\n\t\"client_secret\": \"aaaa-bbbb-cccc-dddd\",\n\t\"grant_type\": \"client_credentials\"\n}");
Request request = new Request.Builder()
.url("https://atenea.trust.lat/oauth/token/")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
var axios = require('axios');
var data = JSON.stringify({"client_id":"1111-2222-3333-4444","client_secret":"aaaa-bbbb-cccc-dddd","grant_type":"client_credentials"});
var config = {
method: 'post',
url: 'https://atenea.trust.lat/oauth/token/',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Responses
HTTP Code: 200 OK
{
"access_token": "sdVEav3xu------------------------------",
"token_type": "Bearer",
"expires_in": 7200,
"created_at": 1590515112
}