I want to call REST API related to file storage of azure through postman. Here is how I am making my request :
I am making request to list all shares in file storage account as described here : https://docs.microsoft.com/en-us/rest/api/storageservices/list-shares
I am getting below error:
"The Date header in the request is incorrect." What changes I should make ?
Edit1 :
When I provided date n correct format, I have error like this :
I am getting below error: "The MAC signature found in the HTTP request '' is not the same as any computed signature. Server used following string to sign: 'GET"
How to resolve this?
The link you point towards holds this example:
The date format you're using is not correct:
EDIT:
On the authorization header, the Authentication for the Azure Storage Services link in the article in your link states the following:
Here's some more info on the Hash-based Message Authentication Code (HMAC)
Since you commented:
That's where the problem is. You shouldn't use the key as the
Signature
for the message, you need to calculate theSignature
based on the key.In short:
Signature
With your updated screenshot, it seems like that your problem is no longer related to x-ms-date. The reason for this 403 error is the Authorization attribute in the Header which format as
You should't directly use the Access Key on Azure Portal as the Signature part of Authorization,instead it should be constructed encoding request string by using the HMAC-SHA256 algorithm over the UTF-8-encoded. format as
which mentioned on the official document.
Sample java code as below show you how to construct Signature part of Authorization:
The auth parameter in the code is generated your Signature mentioned above,then you could fill it in the Authorization property and re-send request in Postman.
The screenshot as below:
Important notice:
In the above code,you should't miss "\ ncomp: list" in the //resources line,otherwise it will also return 403 error. You could find the rules in the Constructing the Canonicalized Resource String.