zendframework / ZendService_Amazon

BSD 3-Clause "New" or "Revised" License
29 stars 37 forks source link

HTTP 403 Forbidden #56

Closed Lucathiel closed 8 years ago

Lucathiel commented 8 years ago

Hello everybody,

I have an issue with the basic example script provide in the Amazon doc (http://zf2.readthedocs.org/en/latest/modules/zendservice.amazon.s3.html) which look like this:

public function testAWSUpload() { $my_aws_key = 'XXXXXXXXXXXXXXXXXXXXXXX'; $my_aws_secret_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

    $s3 = new S3\S3($my_aws_key, $my_aws_secret_key);

    $list = $s3->getBuckets();

In debug mode this code throw me an HTTP 403 Forbidden. Here is the request:

GET / HTTP/1.1 Host: s3.amazonaws.com Connection: close Accept-Encoding: gzip, deflate User-Agent: Zend\Http\Client Content-Type: application/xml Date: Thu, 08 Oct 2015 16:01:58 GMT Authorization: AWS XXXXXXXXXXXXXXXXXX:pyGz5Fjvqo2ahnmHq78/nfV5p9M=

And there is the response:

HTTP/1.1 403 Forbidden x-amz-request-id: F84DE8F4433CA8C3 x-amz-id-2: pK7eAIyPEIMtaYNWDUHLX8qIqRJVCdqKX6alDGlWJKL2ikKZTsKACkiP0mOt5jidYDJvQ2zAQJk= Content-Type: application/xml Transfer-Encoding: chunked Date: Thu, 08 Oct 2015 16:01:58 GMT Server: AmazonS3

2eb <?xml version="1.0" encoding="UTF-8"?>

SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.XXXXXXXXXXXXXXXXXXXXXXGET application/xml Thu, 08 Oct 2015 16:01:58 GMT /pyGz5Fjvqo2ahnmHq78/nfV5p9M=47 45 54 0a 0a 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 6d 6c 0a 54 68 75 2c 20 30 38 20 4f 63 74 20 32 30 31 35 20 31 36 3a 30 31 3a 35 38 20 47 4d 54 0a 2fF84DE8F4433CA8C3pK7eAIyPEIMtaYNWDUHLX8qIqRJVCdqKX6alDGlWJKL2ikKZTsKACkiP0mOt5jidYDJvQ2zAQJk=

0

I test my AWS KEY and AWS SECRET KEY on this site who return me the good name and canonical ID: http://www.bucketexplorer.com/awsutility.aspx

Anobody have a clue on what's happening?

Thank you

Lucathiel commented 8 years ago

Problem solved, the error occured because of date format.