An Azure service that offers file shares in the cloud.
there is a similar sample code provided for generateBlobSASQueryParameters in the below article please validate against generateFileSASQueryParameters if that works for you.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This is the error when accessing the URL
<?xml version="1.0" encoding="utf-8"?><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:058707dc-e01a-006b-19bf-c5c5f9000000
Time:2023-08-03T04:07:04.6473054Z</Message><AuthenticationErrorDetail>Signature did not match. String to sign used was r
2023-08-10T04:07:03Z
/file/*******/config/contents/1691035621111-Planet_zoo.pdf
https
2022-11-02
</AuthenticationErrorDetail></Error>
And this is the code block being used.
const account = "*******";
const accountKey = "*********************************************************";
const AZFSSignedURL = async (contentDirectory, fileName, shareName = shareName) => {
const shareClient = serviceClient.getShareClient(shareName);
const directoryClient = shareClient.getDirectoryClient(contentDirectory);
const fileClient = directoryClient.getFileClient(fileName);
const expiresOn = new Date();
expiresOn.setDate(expiresOn.getDate() + 7);
const sasToken = generateFileSASQueryParameters(
{
fileSystemName: shareName,
shareName: fileClient.shareName,
filePath: fileClient.name,
permissions: "r",
expiresOn: expiresOn,
protocol: SASProtocol.Https,
version:'2022-11-02'
},
credential
);
console.log(sasToken)
const url = fileClient.url + "?" + sasToken.toString();
return { success: true, url: url, error: false };
};
An Azure service that offers file shares in the cloud.
there is a similar sample code provided for generateBlobSASQueryParameters in the below article please validate against generateFileSASQueryParameters if that works for you.