Il token può essere rinnovato attraverso una richiesta di refresh che richiede i seguenti parametri in formato application/x-www-form-urlencoded con encoding UTF-8.
curl -X POST https://auth.fatturazioneelettronica.aruba.it/auth/signin \
-H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
-d 'grant_type=refresh_token' \
-d 'refresh_token=262ac1f88ad1e9e5'
<?php
// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:
include("chilkat_9_5_0.php");
$rest = new CkRest();
// URL: https://auth.fatturazioneelettronica.aruba.it/auth/signin
$bTls = true;
$port = 443;
$bAutoReconnect = true;
$success = $rest->Connect('auth.fatturazioneelettronica.aruba.it',$port,$bTls,$bAutoReconnect);
if ($success != true) {
print 'ConnectFailReason: ' . $rest->get_ConnectFailReason() . "\n";
print $rest->lastErrorText() . "\n";
exit;
}
$rest->AddQueryParam('grant_type','refresh_token');
$rest->AddQueryParam('refresh_token','262ac1f88ad1e9e5');
$strResponseBody = $rest->fullRequestFormUrlEncoded('POST','/auth/signin');
if ($rest->get_LastMethodSuccess() != true) {
print $rest->lastErrorText() . "\n";
exit;
}
$respStatusCode = $rest->get_ResponseStatusCode();
if ($respStatusCode >= 400) {
print 'Response Status Code = ' . $respStatusCode . "\n";
print 'Response Header:' . "\n";
print $rest->responseHeader() . "\n";
print 'Response Body:' . "\n";
print $strResponseBody . "\n";
exit;
}
$jsonResponse = new CkJsonObject();
$jsonResponse->Load($strResponseBody);
// See the Online Tool for Generating JSON Parse Code
$access_token = $jsonResponse->stringOf('access_token');
$token_type = $jsonResponse->stringOf('token_type');
$expires_in = $jsonResponse->IntOf('expires_in');
$refresh_token = $jsonResponse->stringOf('refresh_token');
$client_id = $jsonResponse->stringOf('client_id');
$userName = $jsonResponse->stringOf('userName');
$Issued = $jsonResponse->stringOf('\'.issued\'');
$Expires = $jsonResponse->stringOf('\'.expires\'');
?>
{
"access_token": "571a08cd6275e81e",
"token_type": "bearer",
"expires_in": 1800,
"refresh_token": "111ac1f88ad1efff",
"client_id": "123456",
"userName": "Utente",
".issued": "Mon, 21 Jan 2019 16:36:17 GMT",
".expires": "Mon, 21 Jan 2019 17:06:17 GMT"
}