Reputation: 551
I use the policy like this:
var sharedAccessPolicy = {
AccessPolicy:{
Permissions: azure.Constants.BlobConstants.SharedAccessPermissions.WRITE,
//Start: //use for start time in future, beware of server time skew
Expiry: formatDate(new Date(new Date().getTime() + 10 * 60 * 1000)) //10 minutes from now
}
Which works well. But if I want to generate the SAS With both READ and WRITE permissions, how should I do?
Permissions: azure.Constants.BlobConstants.SharedAccessPermissions.WRITE| azure.Constants.BlobConstants.SharedAccessPermissions.Read
Doesn't work... I'm not familiar with that SDK... Please help~
Upvotes: 1
Views: 275
Reputation: 136216
Based on the source code here: https://github.com/WindowsAzure/azure-sdk-for-node/blob/master/lib/util/constants.js
, SharedAccessPermissions
is just an enum. Try the following code instead of using the constant:
var sharedAccessPolicy = {
AccessPolicy:{
Permissions: 'rw',
//Start: //use for start time in future, beware of server time skew
Expiry: formatDate(new Date(new Date().getTime() + 10 * 60 * 1000)) //10 minutes from now
}
One more thing: You're using Date
. Please note that in Windows Azure everything's in UTC so if you're in a different timezone and running the code locally, things may not work as expected.
Upvotes: 1