'Http 403 server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature

I generated SAS url with below code

var blobBuilder = new BlobSasBuilder()
            {
                ExpiresOn = DateTimeOffset.UtcNow.AddDays(2),
                Protocol = SasProtocol.Https,
                StartsOn = DateTimeOffset.UtcNow.AddDays(-2),
                BlobContainerName = _containerName
            };

            var blockBlob = _blobContainer.GetBlobClient(fileName);
            blobBuilder.SetPermissions(BlobAccountSasPermissions.Read);

            var isBlobExist = blockBlob.Exists();
            if (isBlobExist)
            {
                var uriData = blockBlob.GenerateSasUri(blobBuilder);
                if (uriData != null)
                {
                    path = uriData.AbsoluteUri;
                }
            }

Generated URI is working most of the time for mobile users but sometimes it returns this error message when trying to download file

server returned http 403 server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature

I am not sure what wrong am I doing here because it works most of the time but doesn't work sometime. I am also wondering if this is the case when someone try to override the file and other user is trying to read it. Please suggest



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source