title: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method
body: <p>My test request for Amazon Web Service API is returning with the following error:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ItemSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2005-10-05/"&gt;
    &lt;Error&gt;
      &lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;
      &lt;Message&gt;
       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.
      &lt;/Message&gt;
    &lt;/Error&gt;
    &lt;RequestId&gt;ebe90459-1abd-403e-bfec-6916ebe07e1f&lt;/RequestId&gt;
  &lt;/ItemSearchErrorResponse&gt;
  </code></pre>
  
  <p>Here is how I arrived at this:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  $private_key = "XXXXXXXXXXXXXXXXXXXXXX";
  $date = urlencode(date('Y-m-d\TH:i:s.Z\Z', time()));
  $string_to_sign = "GET webservices.amazon.com /onca/xml/ AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXXXXXA&amp;Keywords=Rocket&amp;Operation=ItemSearch&amp;SearchIndex=Toys&amp;Service=AWSECommerceService&amp;Timestamp=".$date."";
  $signature = urlencode(base64_encode(hash_hmac("sha256",$string_to_sign, $private_key, True)));
  $url = "http://webservices.amazon.com/onca/xml?AWSAccessKeyId=XXXXXXXXXXXXXXXXXXXXXXXX&amp;Keywords=Rocket&amp;Operation=ItemSearch&amp;SearchIndex=Toys&amp;Service=AWSECommerceService&amp;Timestamp=".$date."&amp;Signature=".$signature."";
  
  header("Location: ".$url."");
  
  ?&gt;
  </code></pre>
  
  <p>I basically wanted a signed REST request directly in the url (hence the header function) but left me stuck with the error. I double checked my access id and secret key so I know they are not the one causing the problem. Is this not the right way to produce the signature?</p>