Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature Does Not Match - Sub-folders #155

Closed
nodeGarden opened this issue Sep 29, 2013 · 3 comments
Closed

Signature Does Not Match - Sub-folders #155

nodeGarden opened this issue Sep 29, 2013 · 3 comments
Labels
guidance Question that needs advice or information.

Comments

@nodeGarden
Copy link

TL:DR: Using a sub-folder in the Bucket path causes the Signature to not match.

I've tried for 2-3 days now to get this to work. I am using the below code to grab a signedURL for an asset uploaded:

require_once("../includes/aws/aws-autoloader.php");
use Aws\S3\S3Client;

$s3 = S3Client::factory(array(
    'key'    => $config->s3Key,
    'secret' => $config->s3Secret
));

$s3URL = $s3->getObjectUrl('bucket/folder', $filename, '+1 hour');

Unfortunately I always get the error SignatureDoesNotMatch

I tested with the Amazon S3 Signature Tester, and when I put in my secret key it gives me the correct signature, which I can append to the URL and the download works. I have quadruple confirmed that the value of $config->s3Secret is indeed the correct value, and is echo'ing correcting at that specific point in time too.

I have pulled the lasted from Master branch as well as tried the Zip file download from the documentation site.

I then switched my upload location to NOT include subfolders, and BAM, it works.

$s3URL = $s3->getObjectUrl('bucket', $filename, '+1 hour');
@jeremeamia
Copy link
Contributor

The "subfolder" should be a part of the second argument, which should be the full object key. Try this:

$key = 'folder/' . $filename;
$s3URL = $s3->getObjectUrl('bucket', $key, '+1 hour');

@jeremeamia
Copy link
Contributor

This should solve the issue you are having. Feel free to reopen if you have any additional problems.

@VikasPace
Copy link

This should solve the issue you are having. Feel free to reopen if you have any additional problems.

Thank You. my issue is resolved now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants