jakeFeldman / strapi-provider-upload-azure-storage

Strapi Provider Upload Azure Storage
MIT License
75 stars 42 forks source link

403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.) #75

Open walterspieler opened 1 year ago

walterspieler commented 1 year ago

Hello, I hope you're all fine.

I have a bug when I try to download a media from the media library. My Azure config seems fine since I can upload media to my azure storage.

Screenshot 2023-06-29 at 11 59 27 Screenshot 2023-06-29 at 11 37 39

I can provide a screenshot of the query

Screenshot 2023-06-29 at 12 01 39

Thank you for your answers :)

jakeFeldman commented 1 year ago

Hello @walterspieler, thanks for reporting. I would need to do some testing to see how strapi is trying to download. Will you confirm that your access key has sufficient perms to allow downloads?

walterspieler commented 1 year ago

Hello @jakeFeldman, Sorry i only see this message now. Yes I am Admin on Strapi side and I have all rights in storage. I use the Access key. I even tried with a signature (Shared Access Signature) w/ everything checked

Screenshot 2023-07-05 at 17 31 25
jakeFeldman commented 1 year ago

Sorry for the delay. I've been very busy at work ad have not had the time to work on this package. I'm looking for someone to help maintain the package.

ArjanBlokJump commented 1 year ago

The problem is that Strapi send the strapi bearer token to the storage url since the latest update.

conradagramont commented 1 year ago

In your associated .env file, you need to add the following: STORAGE_ACCOUNT_SAS_TOKEN=

The problem in the code is this line:

if (sasToken != '') {

It's specifically looking for a blank value. In my case, I didn't put that value into the .env and I'm assuming that it's determined to be a null value. Thus, the code within the if statement is always run.

I did try putting in a value for "STORAGE_ACCOUNT_SAS_TOKEN" as well, but that didn't work either. Anyhow, it works now with the accountKey.

jaredbouwer commented 1 year ago

I'm having the same issue. When clicking download, wouldn't it be easier to just open the download link in a new tab?