dimanche 29 mars 2015

"The request signature we calculated does not match the signature you provided" using different access/secret keys

I've read a lot of this like issues here and I've got a good answers that solved other my problems.


I've created my own AWSAccessKeyId and secretAccess and the request has been done, but when my client gives me his AWSAccessKeyId and secretAccess I got this message:



<ItemLookupErrorResponse xmlns="http://ift.tt/1DUnkoW">
<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>c53a74b1-4db2-4356-aca9-1b7d1519737b</RequestId>
</ItemLookupErrorResponse>


Here is my code:



var today = new Date();
time = today.toISOString();
time = encodeURIComponent(time);

var AWSAccessKeyId = "My Key";
var secretAccess = "SECRET ACCESS";
var associateTag = "";

var messageToEncrypt ="GET\nwebservices.amazon.com\n/onca/xml\nAWSAccessKeyId="+AWSAccessKeyId+"&ItemId=0679722769&Operation=ItemLookup&ResponseGroup=SalesRank&Service=AWSECommerceService&Timestamp="+time+"&Version=2013-08-01";
var sig = CryptoJS.HmacSHA256(messageToEncrypt, secretAccess);

sig = sig.toString(CryptoJS.enc.Base64);
sig = encodeURIComponent(sig);

var request = "http://ift.tt/1ONCXlp"+AWSAccessKeyId+"&ItemId=0679722769&Operation=ItemLookup&ResponseGroup=SalesRank&Service=AWSECommerceService&Timestamp="+time+"&Version=2013-08-01&Signature="+sig;


What is caused the problem? Is their anything else I've to ask my client to do to get the right keys? My client from another country, is this cause another problem?


I don't change a lot, just change the keys.





Aucun commentaire:

Enregistrer un commentaire