title: How do I GET an Amazon S3 presigned url's object from jQuery Ajax
body: <p>I can find nothing on Google.</p>
  
  <p>I am properly creating presigned urls because they do work if I use a browser to load the request.</p>
  
  <p>However, when using the identical url from a jQuery ajax call it is failing and telling me the request signature is wrong.</p>
  
  <p>PS: Here are the headers. First section is from successful browser call and second section my ajax failure.</p>
  
  <pre><code>HTTP/1.1 200 OK
  x-amz-id-2: clb7J//+XLYa+XS4HJthLdDO0KxBJU02fyBt29Kr8A2TXRJXM189tGgy7bWgmoYkDzXWUhg3R5g=
  x-amz-request-id: F3A8C4ED98E5443E
  Date: Mon, 04 May 2015 21:53:24 GMT
  Access-Control-Allow-Origin: &lt;any valid value&gt;
  Access-Control-Allow-Methods: GET, DELETE, HEAD
  Access-Control-Allow-Headers: accept, content-type
  Access-Control-Max-Age: 3000
  Access-Control-Allow-Credentials: true
  Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
  Content-Length: 0
  Server: AmazonS3
  
  
  BAD AJAX:
  
  HTTP/1.1 403 Forbidden
  Access-Control-Allow-Origin: &lt;any valid value&gt;
  Access-Control-Allow-Methods: GET, DELETE, HEAD
  Access-Control-Max-Age: 3000
  Access-Control-Allow-Credentials: true
  Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
  x-amz-request-id: 05071412E03C4541
  x-amz-id-2: xw5uMr2N/alPOR7MFMbX6fVkVEf1p30VhQKyP3yUqxYXxDq+vb5hzlsyShHwY4XhgAfLd3BCjG0=
  Content-Type: application/xml
  Transfer-Encoding: chunked
  Date: Mon, 04 May 2015 21:53:24 GMT
  Server: AmazonS3
  
  
  Here is my Ajax call:
  
      $.ajax({
                  type: "GET",
                  url: presignedurl,
                  contentType: 'application/json; charset=utf-8',
                  cache: false,
                  async: true,
                  dataType: "text",
                  error: function (xhr, status, error) {
                      CentralScrutinizer("FetchDetails Exception: " + error);
                  },
                  success: function (payload) {
                      try {
                          $('#newTaskDetails').val(payload);
  
                      } catch (e) {
  
                      }
  
                  }
              });
  
  The specific error is:
  
  &lt;?xml version="1.0" encoding="UTF-8"?&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 key and signing method.&lt;/Message&gt;
  
  Again, the closest I could find was a similar SO post for a put but they merely suggested adding the following headers:
  
  //headers: { 'Content-Type': 'application/json; charset=utf-8' },
  
  I tried that but it made no difference.
  
  I also used fiddler to compare the two GETs (browser versus ajax) and the only thing different I see is the jsonp callback parameter.
  
  That shouldn't affect the signature, should it?
  
  Here are the headers
  
  Browser Success:
  
      HTTP/1.1 200 OK
      x-amz-id-2: clb7J//+XLYa+XS4HJthLdDO0KxBJU02fyBt29Kr8A2TXRJXM189tGgy7bWgmoYkDzXWUhg3R5g=
      x-amz-request-id: F3A8C4ED98E5443E
      Date: Mon, 04 May 2015 21:53:24 GMT
      Access-Control-Allow-Origin: &lt;any valid origin&gt;
      Access-Control-Allow-Methods: GET, DELETE, HEAD
      Access-Control-Allow-Headers: accept, content-type
      Access-Control-Max-Age: 3000
      Access-Control-Allow-Credentials: true
      Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
      Content-Length: 0
      Server: AmazonS3
  
  BAD AJAX:
  
      HTTP/1.1 403 Forbidden
      Access-Control-Allow-Origin:: &lt;any valid origin&gt;
      Access-Control-Allow-Methods: GET, DELETE, HEAD
      Access-Control-Max-Age: 3000
      Access-Control-Allow-Credentials: true
      Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
      x-amz-request-id: 05071412E03C4541
      x-amz-id-2: xw5uMr2N/alPOR7MFMbX6fVkVEf1p30VhQKyP3yUqxYXxDq+vb5hzlsyShHwY4XhgAfLd3BCjG0=
      Content-Type: application/xml
      Transfer-Encoding: chunked
      Date: Mon, 04 May 2015 21:53:24 GMT
      Server: AmazonS3
  </code></pre>
  
  <p>Thanks!</p>