1

I am getting this response to GET request to amazon product api.

    <?xml version="1.0"?>
<ItemSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2011-08-01/"><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message></Error><RequestId>9aff7feb-7f9b-4efb-aece-b595b1b7b0e5</RequestId></ItemSearchErrorResponse>

In my javascript, I am generating signature as:

  var paramO = {
    Service:'AWSECommerceService',
    Operation:'ItemSearch',
    AWSAccessKeyId:AccessKeyId,
    AssociateTag:AssociateTag,
    Version:'2011-08-01',
    SearchIndex:'All',
    Keywords:name,
    ResponseGroup:'ItemAttributes,OfferSummary',
    Timestamp:timestamp
  };
  var string='GET\nwebservices.amazon.in\n/onca/xml\n';
  console.log(string+$.param(paramO));
  var hash = CryptoJS.HmacSHA256(string+$.param(paramO), SecretAccessKey);
  var signature = CryptoJS.enc.Base64.stringify(hash);
Harshil Pansare
  • 1,117
  • 1
  • 13
  • 37
  • Check out http://stackoverflow.com/questions/29241872/how-can-i-create-signature-for-aws-api-in-javascript-using-hmacsha256. – jarmod Sep 29 '15 at 23:48
  • possible duplicate of [Amazon MWS - request signature calculated does not match the signature provided](http://stackoverflow.com/questions/2777078/amazon-mws-request-signature-calculated-does-not-match-the-signature-provided) – Prune Sep 30 '15 at 00:25
  • both the solutions are not working – Harshil Pansare Sep 30 '15 at 01:04
  • here is what i have tried till now: 1. using base64encode() function @jarmod 2. checked that i have correct secret and access id 3. there is no space before or after secret access key 4. when i try scratchpad it works, therefore there is some issue in hmac-sha256 here:http://associates-amazon.s3.amazonaws.com/scratchpad/index.html – Harshil Pansare Sep 30 '15 at 01:13
  • 5. sorted string in ascii sequence – Harshil Pansare Sep 30 '15 at 06:07

0 Answers0