I am trying to get an object from my bucket but I always get the "signature does not match" error. I got my signature generation function from AWS sample code so I am sure that this works. I also tested the upload function and it works. I am only having trouble with the get object function. I spent a huge amount of hours verifying all scenarios/answers in this post but nothing worked. So here I am seeking your help.
Am I missing something in the headers? Here is a sample canonical request that gets created:
GET
/index.html
host:<bucketname>.s3.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20211127T120453Z
host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
EDIT1:
I tried the AWS sample code by compiling it using javac
, then ran it, the get object function works fine. But when added into my Android project, it does not work. To make sure that I copy the sample code as is, I generated its jar file and included the resulting jar file in my project. Still, same issue. This is frustrating. Argg!
EDIT2: Minimal reproducible example
- Download the sample code from the link above
- Add the code into your Android project except for
com.amazonaws.services.s3.sample.RunAllSamples
class. - Add this call in one of your activities:
GetS3ObjectSample.getS3Object(<bucketName>, <regionName>, <awsAccessKey>, <awsSecretKey>);
from Amazon S3 Error: The request signature we calculated does not match the signature you provided. Check your key and signing method
No comments:
Post a Comment