I am trying to create a sas token from react app
async function GenerateSASToken() {
const sasUrl = `https://${accountname}.blob.core.windows.net?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2023-02-20T16:01:34Z&st=2023-02-20T08:01:34Z&spr=https&sig=<signinkey>`;
axios.get(sasUrl)
.then(response => {
console.log(response.data);
console.log('SUCCESS');
})
.catch(error => {
console.log('FAIL');
console.error(error);
});
}
But I am getting error while calling endpoint as
400 (Value for one of the query parameters specified in the request URI is invalid.)
The reason you are getting this error is because you are using incorrect URL.
If you want to download a blob, the URL should be something like
https://${accountname}.blob.core.windows.net/<container-name>/<blob-name>?sv=2021-06-08&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2023-02-20T16:01:34Z&st=2023-02-20T08:01:34Z&spr=https&sig=<signinkey>.The URL you are using corresponds to
Get Account Informationwhich requiresrestype=account&comp=propertiesURL parameters. Since you are not including these parameters in your URL, you are getting 400 error.UPDATE
If you are trying to generate a new SAS token, please note that: