post
https://services.scaleup.com.br/authentication/v1/oauth/token/temporary
Recovering authorization token using the client credential and temporary token (Access Token) per user [USER-CODE]:
//[CREDENTIALS] ARE STORED IN COOKIES.
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("X-User-Code", "[X-USER-CODE]");
myHeaders.append("Authorization", "Bearer [AUTHORIZATION]");
var requestOptions = {
method: 'POST',
headers: myHeaders,
};
fetch("https://services.scaleup.com.br/authentication/v1/oauth/token/temporary", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
// RECOVERY COOKIES FROM AUTH TOKEN with Client Credentials
$code = $client->request(
'POST',
'https://services.scaleup.com.br/authentication/v1/oauth/token/temporary',
['headers' =>
[
'Content-Type' => 'application/x-www-form-urlencoded',
'X-User-Code' => '[USER-CODE]'
],
'Authorization' => 'Bearer [AUTHORIZATION],
]
);
if ($response->getStatusCode() != 200) {
throw new \Exception(
'Error with status code: '
. $response->getStatusCode()
. 'and body: '
. $response->getBody()->getContents()
);
}
//GET ACCESS TOKEN
$finalCode = (string) $code->getBody();
$json = json_decode($finalCode);
$accessToken = $json->access_token;
