We suddenly started receiving these errors today:
{“requestId”:“459747eac1bc099e04eb3a62c164b6ed”,“error”:{“code”:“errorAuthorization”,“message”:“Unauthorized”,“description”:“Operation Failed. The authorization data is incorrect.”,“dateTime”:“2025-03-25T17:00:47.2684895Z”,“innerError”:null}}
We haven’t changed anything on our end. Is there a known issue going on right now? The status page says not, but maybe we’re the first to discover it?
@mrceolla2
Could you please provide more details about the context in which you are receiving these unauthorized errors? For example, what specific operation are you trying to perform when the error occurs?
Hi,
Thank you for your quick reply. This is our PHP function which was working fine until today:
function convertTXTASPOSE ($access_token, $FileData) {
$data = array(
'sourceFilename'=>$FileData
);
$Headers = ["Content-Type: multipart/form-data", "Accept: application/octet-stream", "Authorization: Bearer $access_token"];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.aspose.cloud/v4.0/words/convert?format=txt");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, $Headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
return curl_exec ($ch);
}
how often do you update your token? as in the code above I can’t find it.
In this area of code it should get updated on each call. The token PHP function is below:
function getJSONWebTokenASPOSE () {
global $ASPOSE_AppSID;
global $ASPOSE_Appkey;
$data = array(
‘grant_type’=>‘client_credentials’,
‘client_id’=>$ASPOSE_AppSID,
‘client_secret’=>$ASPOSE_Appkey
);
$Headers = [‘Content-Type: application/x-www-form-urlencoded’,‘Accept: application/json’];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://api.aspose.cloud/connect/token’);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_HTTPHEADER, $Headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$result = json_decode(curl_exec ($ch), true);
return $result[‘access_token’];
}
I see. Please consider changing that behavior to obtain a token not for every call, as the token lifetime is 24 hours. But it should not be a reason for that error. Please share your client id I will share it with admin team to check why do you get 401 error.
Is that safe to post in a forum? Can’t that be looked up from my requestId?
“requestId”:“459747eac1bc099e04eb3a62c164b6ed”
Yes, it is safe. I only ask for the client ID; I don’t need the client secret. I tried to find any requests in our logs with that request ID, but I didn’t find any for the last two months. I asked the admin team to double-check.
It is working fine for us today. Did the admin team do something to get it working again?
No, as far as I know, everything works as it was.