yii2tech / file-storage

This package has been abandoned. See: https://www.patreon.com/posts/59332556
Other
119 stars 30 forks source link

AWS authorization mechanism not supported #10

Closed bizley closed 7 years ago

bizley commented 7 years ago

There is the problem with authorizing AWS user on the region using V4 signature.

I'm using this configuration:

'class' => 'yii2tech\filestorage\amazon\Storage',
'awsKey' => '...',
'awsSecretKey' => '...',
'buckets' => [
    'bucket_name' => [
        'region' => Aws\Common\Enum\Region::FRANKFURT, // 'eu-central-1'
        'acl' => 'public',
        'fileSubDirTemplate' => '{ext}/{^name}/{^^name}',
    ],
],

This is the AWS response on authorization:

The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

Based on the Aws\S3\S3Client::factory() and Aws\S3\S3Client::createSignature() methods it looks like AWS can switch to V4 based on the region provided but it can be done only on the bucket level where it's too late.

Adding region on the storage level works like a charm (yii2tech\filestorage\amazon\Storage::createAmazonS3()).

Packages versions:

klimov-paul commented 7 years ago

Resolved by commit caa55ac3e51e15a21af14f056a00696c032a2d8a

bizley commented 7 years ago

Thanks!