I'm writing a Thunderbird Extension to add an email to a Rackspace email account spam blocklist.
Rackspace provides an API for adding emails to an accounts blocklist.
My Ajax GET Request is:
$.ajax({
beforeSend: function(request)
{
console.log("beforeSend");
request.setRequestHeader("X-Api-Signature", Signature);
request.setRequestHeader("Accept", "text");
request.setRequestHeader("withCredentials", true);
request.setRequestHeader('crossOrigin','anonymous'),
console.log("beforeSend Request %o: " , request);
return true;
},
contentType: 'application/x-www-form-urlencoded',
crossDomain: true,
dataType: 'jsonp',
method: 'GET',
type: 'GET',
url: Api_Obj.Url,
When I submit the Ajax GET request with the url:
(account number 123456 is placeholder for actual account number for security purposes)
I get:
Loading failed for the with source “https://api.emailsrvr.com/v1/customers/123456/domains/sandypondconsulting.com/spam/blocklist/EglogicsSoftech@outlook.com?callback=jQuery36003174572175672028_1625074250859&_=1625074250860”.
I've set the manifest:
"content_security_policy" : "script-src 'self' https://api.emailsrvr.com; object-src 'self'",
The Ajax error function parameters have these values:
msg: error
error: error
When I click on the url in the Loading failed error I get:
<unauthorizedFault xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.emailsrvr.com/v0/Schemas" code="403">
<message>Authentication failed.</message>
<details>6/30/2021 1:34:21 PM</details>
</unauthorizedFault>
The unauthorized fault tells me that I've probably incorrectly generated the X-Api-Signature required by the Rackspace API.
So, looks like I have two problems:
- Loading failed for script.
2) UnauthorizedFault
I'm looking to solve the script loading problem first. And, then figure out the UnauthorizedFault 2nd.
Thanks, Ed