Amazon Product API returns “SignatureDoesNotMatch”

匆匆过客 提交于 2019-12-04 13:32:34

Create a variable from the timestamp to use it inside $string_to_sign and the url-parameter, otherwise it may happen that both timestamps differ. To provide more help you'll need to show the creation of $string_to_sign.

Furthermore: the Timestamp-parameter needs to be urlencoded too.

Maybe this is usefull to you: http://mierendo.com/software/aws_signed_query/

The "signature" for the request includes the request "operation" parameter and a timestamp. Here is a function that should work to create a signature:

function createSignature($operation,$timestamp){
    $the_string=$operation.$timestamp;
    return base64_encode(hash_hmac("sha256",$the_string,$this->secret_key,true));
}

The timestamp you send in the request should be the same as the one passed to the createSignature function. In other words, don't generate a timestamp twice. Save it to a variable and then use that for both.

Also, here is a PHP class I created to simplify the process of making requests to the API: https://github.com/traviswimer/AmazonProductAPI_SOAPer/blob/master/AmazonApi.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!