I am trying to create a url for a blob with a shared signature using BlobService.getBlobURL() in the Azure library on Node.js on my local machine. But when I try to get blob through the generated URL, I get an authentication error message that says "signature does not match." Downloading the same block from the Azure Management portal works great.
The following is the code I use to create the url:
process.env['AZURE_STORAGE_ACCOUNT'] = "[MY_ACCOUNT_NAME]"; process.env['AZURE_STORAGE_ACCESS_KEY'] = "[MY_ACCESS_KEY]"; var azure = require('azure'); var blobs = azure.createBlobService(); blobs.getBlobUrl('[CONTAINER_NAME]', "[BLOB_NAME]", { AccessPolicy: { Start: Date.now(), Expiry: azure.date.minutesFromNow(60), Permissions: azure.Constants.BlobConstants.SharedAccessPermissions.READ }});
URL generated by this function:
https://[MY_ACCOUNT_NAME].blob.core.windows.net:443/[CONTAINER_NAME]/ [ENCODED_BLOB_NAME] ?st=2013-10-28T18%3A34%3A23Z &se=2013-10-28T19%3A34%3A23Z &sp=r &sr=b &sv=2012-02-12 &sig=rLB%2FEOAWzijkkWcseju8TJLAxzeE5e3Pvq1i68i5Erc%3D
When I try to paste this URL into the browser, I get the following error message:
<Error> <Code>AuthenticationFailed</Code> <Message> Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:9fe3d3ed-97f4-43d1-8c65-c95ce6b15a08 Time:2013-10-28T18:34:43.3015398Z </Message> <AuthenticationErrorDetail> Signature did not match. String to sign used was r 2013-10-28T18:34:23Z 2013-10-28T19:34:23Z /[MY_ACCOUNT_NAME]/[CONTAINER_NAME]/[BLOB_NAME] 2012-02-12 </AuthenticationErrorDetail> </Error>
Then I tried to log into the Azure management portal by selecting the same blob and downloading it. It worked. URL provided on the management portal:
http://[MY_ACCOUNT_NAME].blob.core.windows.net/[CONTAINER_NAME]/ [ENCODED_BLOB_NAME] ?sv=2012-02-12 &st=2013-10-28T18%3A35%3A16Z &se=2013-10-28T18%3A42%3A16Z &sr=b &sp=r &sig=kcjV%2BkrNAaWOj%2F7NFwmHefXJEiEyu61U7mUTsw3pw7w%3D
remeika
source share