I'm trying to retrieve some files from a S3 bucket, but the files are setup to be private. I'm currently using ListObjects to retrieve all the files in my bucket, but on the result set it does not include the signed url and since the file is private I cannot display it on my website.
I'm using mongoDB Stitch to connect to my S3 bucket.
Here my code that retrieves all the files in my bucket.
const aws = this.client.getServiceClient(AwsServiceClient.factory, "TESTAPP");
const args = {
Bucket: bucketName,
Prefix: folderName
};
const request = new AwsRequest.Builder()
.withService('s3')
.withAction('ListObjects')
.withArgs(args);
aws.execute(request.build())
.then(result => {
console.log(result);
}
When I look at the console.log I can see all the file information but the I try to access the file since it is a private file I get an error saying I do not have access to it.
Do I need to make another call to get the signed url or is it possible to get all at once?