Error connecting to azure blob storage API from R

后端 未结 3 1898
长情又很酷
长情又很酷 2020-12-17 02:44

I am attempting to work with Azure storage via the REST API in R. I\'m using the package httr which overlays Curl.

Setup

You can use R-fiddle: http://www.r

3条回答
  •  清酒与你
    2020-12-17 02:55

    It looks like you are using the key of your account directly in the Authorization header. To authenticate a request, you must sign the request with the key for the account that is making the request and pass that signature as part of the request. Please see Authentication for the Azure Storage Services for more information on how to construct the Authorization header.

    Please also note that the service returns StringToSign in the error response. So, what your code should have done is to apply the following formula to StringToSign="GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Wed, 25 Mar 2015 22:24:12 GMT\nx-ms-version:2014-02-14\n/preconstuff/pings\ncomp:list\nrestype:container" (without quotes):

    Signature=Base64(HMAC-SHA256(AccountKey, UTF8(StringToSign)))
    

    How the service calculates StringToSign is explained in detail in the link shared above.

提交回复
热议问题