I'm trying to build a web app that should fetch a pre-signed Amazon S3 URL, and then upload a file to that URL using Knox.
However S3 gives me this error when I try to access my bucket
<Error><Code>InvalidArgument</Code><Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message><ArgumentName>Authorization</ArgumentName><ArgumentValue>Bearer *****bearer token*****</ArgumentValue><RequestId>1AFD8C7FD2D7E667</RequestId><HostId>ID</HostId></Error>
I can see that my request to Amazon not only contains my Amazon keys, but also my Authorization Header
https://bucket.s3-eu-west-1.amazonaws.com/image.jpg?Expires=1418226249&AWSAccessKeyId=<key>&Signature=DHYCio7Oao%2BnzPWiiWkGlHb0NAU%3D
and the header Authorization:Bearer
the code looks like
$http.post(image, data, {headers: { 'Authorization': null }, withCredentials: false} ).success(function (url) {
item.images[0] = url;
$http.post('/api/item', item);
});
How do I get rid of the Authorization token for requests not pointing to my domain?
Regards