jape
jape

Reputation: 2901

The request signature we calculated does not match the signature you provided - AWS

I am receiving the following error when trying to access one of my files on S3:

<Error>
    <Code>SignatureDoesNotMatch</Code>
    <Message>
        The request signature we calculated does not match the signature you provided. Check your key and signing method.
    </Message>
</Error>

The image shows normally on my website, but accessing it through my API gives me the error above. Any idea why this would be happening?

S3 settings:

AWS_ACCESS_KEY_ID = 'key here'
AWS_SECRET_ACCESS_KEY = 'key here'

AWS_STORAGE_BUCKET_NAME = 'bucket name'
AWS_CLOUDFRONT_DOMAIN = 'something.cloudfront.net'

STATICFILES_STORAGE = 'oby.s3utils.StaticRootS3BotoStorage'
STATIC_S3_PATH = 'media/'
DEFAULT_FILE_STORAGE = 'oby.s3utils.MediaRootS3BotoStorage'
DEFAULT_S3_PATH = 'static/'

S3_URL = '//{}.s3.amazonaws.com/'.format(AWS_STORAGE_BUCKET_NAME)
MEDIA_ROOT = 'this is fine'
STATIC_ROOT = 'this is fine'
MEDIA_URL = '//{}/{}'.format(AWS_CLOUDFRONT_DOMAIN, STATIC_S3_PATH)
STATIC_URL = '//{}/{}'.format(AWS_CLOUDFRONT_DOMAIN, DEFAULT_S3_PATH)

AWS_PRELOAD_METADATA = False

Thank you in advance for any and all help!

Upvotes: 2

Views: 1478

Answers (1)

Barak
Barak

Reputation: 3066

There could be a number of reasons. One common problem is the system time on the client. If it is too far from the 'real' time, this error can occur.

Upvotes: 1

Related Questions