Creating S3 signed URLs in node.js
Asked Answered
G

1

8

I'm using knox module to https://github.com/LearnBoost/knox to create signed URLs for files on S3, something I've done with PHP SDK before.

I can delete files from my bucket, but I'm getting SignatureDoesNotMatch error when I try the generated URLs for files with private ACL.

Code looks like this

var knox = require('knox');
var s3Client = knox.createClient({
key: '*****',
secret: '*****',
bucket: '*****'
});
function getS3Url(filename) {
var expires = new Date();
expires.setMinutes(expires.getMinutes() + 30);
return s3Client.signedUrl(filename, expires);
}
console.log(getS3Url('file.txt'));

What am I doing wrong?

Grandiose answered 22/6, 2011 at 22:15 Comment(1)
Turns out I was missing the leading '/' on filename, signature matches now.Grandiose
G
0

Turns out I was missing the leading '/' on filename, signature matches now.

Grandiose answered 12/2, 2012 at 22:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.