/api/v3/oauth/token
Gerar token de acesso (V3)
Autentica usuario e senha via Basic Auth e retorna um JWT para uso nas demais chamadas V3.
Authorization: Basic base64(username:senha)
curl -X POST "https://gtin.rscsistemas.com.br/api/v3/oauth/token" \
-H "Content-Length: 0" \
-H "Authorization: Basic BASE64_USUARIO_SENHA" \
-H "Accept: application/json"
const credentials = btoa('seu_usuario:sua_senha');
const response = await fetch('https://gtin.rscsistemas.com.br/api/v3/oauth/token', {
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
Accept: 'application/json'
}
});
const data = await response.json();
console.log(data.token);
<?php
$credentials = base64_encode('seu_usuario:sua_senha');
$ch = curl_init('https://gtin.rscsistemas.com.br/api/v3/oauth/token');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '', // POST sem corpo precisa de Content-Length (erro 406)
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Basic ' . $credentials,
'Accept: application/json',
],
]);
$response = curl_exec($ch);
echo $response;
import requests
# User-Agent proprio: o padrao python-requests e recusado pela hospedagem (erro 406)
response = requests.post(
'https://gtin.rscsistemas.com.br/api/v3/oauth/token',
auth=('seu_usuario', 'sua_senha'),
headers={'Accept': 'application/json', 'User-Agent': 'SeuSistema/1.0'}
)
print(response.json()['token'])
{"token":"ACCESS_TOKEN","access_token":"ACCESS_TOKEN","token_type":"Bearer","expires_in":3600,"expires_at":"ISO_8601_UTC","refresh_token":"REFRESH_TOKEN","refresh_expires_in":604800,"refresh_expires_at":"ISO_8601_UTC"}