5
votes

I try to use Blob Service REST API, List Containers (REST API): http://msdn.microsoft.com/en-us/library/windowsazure/dd179352.aspx

So I get access keys from Management Portal->Hosted Services, Storage Accounts & CDN -> Storage Accounts, where I selected my storage (aziztest) and get keys from View Access Keys: there are 2 keys Primary and Secondary.

Then using I created String to Sign: GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Wed, 29 Feb 2012 06:05:13 GMT\nx-ms-version:2009-09-19\n/aziztest\ncomp:list

and make Authorization header using Primary Access Key of my storage: Authorization: SharedKey aziztest:OjfrOTuO4zy1oUWGHkw8uj3%2BgAZq33GWe15gPT/PK%2Bk%3D

And then make GET request to: http://aziztest.blob.core.windows.net/?comp=list

But I get an error: AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:892d1f31-a20d-45a5-b16a-2f7c07519863\nTime:2012-02-29T00:02:44.2841133ZRequest date header not specified

What is wrong in my procedure?

5

5 Answers

1
votes

What you've done seems pretty good, I presume you're following the instructions on MSDN on how to create the authentication header? I can see you've used them in the string which you are signing, but have you included x-ms-date and x-ms-version actually in your request header? The error message would indicate you haven't.

1
votes

I hit similar errors when uploading a blob to azure storage container but coding in javascript. Posting the link to code listing here. Hope it helps someone.

1
votes

I lost one day investigating error "The Date header in the request is incorrect" - and problem was in generating date via PHP. Correct date format is date("D, d M Y H:i:s T");

I used "j" for day, but f.e. Wed, 9 May 2018 10:20:30 GMT is incorrect, it has to be Wed, 09 May 2018 10:20:30 GMT.

0
votes

Details on authentication procedures can be found here http://msdn.microsoft.com/en-us/library/dd179428.aspx

My guess is that x-ms-date is more than 15 minutes from the time the server gets the request.

0
votes

I the same problem in a php application and the issue was the filename encoding accents, so i ended up converting the name of the file to a base64 like this:

 $ext=explode(".",$_FILES["file"]["name"]);
  $_FILES["file"]["name"]=str_replace("=","",base64_encode($_FILES["file"]["name"])).".".$ext[count($ext)-1];