Note that there are some explanatory texts on larger screens.

plurals
  1. POAuthorization Header for Windows Azure Storage REST API from Windows Store App
    primarykey
    data
    text
    <p>So I am just trying to list the tables in the storage account to test the authorization using the <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179405.aspx" rel="nofollow">Query Tables</a> method. I tried using the SDK, but the SDK was trying to reference DLLs that aren't available in RT. Decided to try out the REST API. but am having trouble with the authentication from this spec <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx</a></p> <pre><code> public async Task ExecuteAsync() { try { HttpClient client = new HttpClient(); Dictionary&lt;string, string&gt; headers = GetHeaders("/Tables"); client.DefaultRequestHeaders.Date = DateTimeOffset.Parse(headers["Date"]); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("SharedKey", headers["Authorization"]); const string url = "http://account-name.table.core.windows.net/Tables"; XmlReader reader = XmlReader.Create(await client.GetStreamAsync(url)); // // Do some stuff with the reader here // } catch (Exception e) { // handle exception } } public Dictionary&lt;string, string&gt; GetHeaders(string resource) { Dictionary&lt;string, string&gt; headers = new Dictionary&lt;string, string&gt;(); headers["Date"] = DateTime.Now.ToString("R"); headers["Authorization"] = GetAuthorizationHeader(resource, headers["Date"]); return headers; } public string GetAuthorizationHeader(string resource, string date) { const string key = PRIMARY_KEY; const string accountName = ACCOUNT_NAME; string signee = string.Join("\n", new List&lt;string&gt; { "GET", "", "", date, resource }); // make the signature MacAlgorithmProvider hmac = MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA256"); IBuffer keyMaterial = CryptographicBuffer.ConvertStringToBinary(key, BinaryStringEncoding.Utf8); CryptographicKey hmacKey = hmac.CreateKey(keyMaterial); IBuffer data = CryptographicBuffer.ConvertStringToBinary(signee, BinaryStringEncoding.Utf8); IBuffer hash = CryptographicEngine.Sign(hmacKey, data); string signature = CryptographicBuffer.EncodeToBase64String(hash); return string.Format("{0}:{1}", accountName, signature); } </code></pre> <p>Obviously I am missing something as I continue to get 403's. See any problems looking through this code?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload