There is the requirement to generate SAS token from the client side JavaScript, I have visited many blogs there isn't any live code example of JavaScript code for generating SAS token. I want a working code for generating SAS token from JavaScript.
Found this on web
There's a reason for using a server-side backend to generate the token. In order to generate a token, you would need account key. You could very well generate a SAS token using client-side JavaScript but in order to do that, you would need to expose the account key to your client application which is a big security risk because if someone has key to your account, they can do anything with your storage account. Thus it is recommended that you create SAS token using a server-side application so that you don't expose your account key.
If you still wish to create a SAS token using Client-Side JavaScript, please see Constructing a Service SAS. Essentially go to the section titled Constructing the Signature String at the bottom of that link and write code in JavaScript for that, and compute signature using account key.
https://learn.microsoft.com/en-us/rest/api/storageservices/Constructing-a-Service-SAS?redirectedfrom=MSDN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With