Issue in calling Blob API using Shared Key Authorization using Javascript

Satya Naik 21 Reputation points
2023-01-31T10:47:31.8433333+00:00

https://github.com/Azure-Samples/storage-dotnet-rest-api-with-auth

The above sample is a CSharp sample to create Authorization Header to call the Azure Storage Blob API for getting the blobs.

The same is replicated using the Javascript.

Everything works but when I perform multiple get calls to retrieve multiple blobs inside a for loop. I get an error for few of the blobs due to which few calls fails. Plus this behaviour is not consistent. Sometimes I would get all the blobs without any error. Sometimes none. And sometimes few blobs are successfully fetched and few are not.

Error I get on calling GET Blob API : 

 

"403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)"

 

Is there any sample available for the same in Javascript ?

What could be the possible reasons for this failure. ?

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sumarigo-MSFT 47,466 Reputation points Microsoft Employee Moderator
    2023-01-31T11:29:54.5833333+00:00

    @Satya Naik Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    These samples use the latest Azure Storage JavaScript v12 library. For legacy v11 code, see Getting Started with Azure Blob Service in Node.js in the GitHub repository. Azure Storage samples using v12 JavaScript client libraries
    Requested you to verify and confirm if the blob has the right IAM roles with required permissions (Owner or Contributor).
    If the issue still persist, to troubleshoot the issue further we need the request id and time. Since the issue isn't consistency I would recommend you to contact support, so If you have a support plan, I request you file a support ticket, else please do let us know, we will try and help you get a one-time free technical support. In this case, could you send an email to AzCommunity[at]Microsoft[dot]com referencing this thread as well as your subscription ID. Please mention "ATTN subm" in the subject field. Thank you for your cooperation on this matter and look forward to your reply.

    Additional information : Based on the error message additional work arounds mentioned here:
    https://stackoverflow.com/questions/24492790/azurestorage-blob-server-failed-to-authenticate-the-request-make-sure-the-value
    This is a rather common error that can have many causes. You will find many threads on StackOverflow where users experience this issue.

    Please let us know if you have any further queries. I’m happy to assist you further.  


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.