none
403 accessing TableStorage on local devstoreaacount

    Frage

  • Hi, everybody,

    although I've been looking for this one on the web I couldn't find anything that helped me out of this, hence I post it here hoping somebody can help.

    I'm trying to access a table in TableStore using REST directly. Sadly, I have to because I'm writing a framework, not an application. I need the ability to form queries dynamically because I don't know which tables or filters my customers, the application evelopers, will need later on.

    A query to return all entities of a given testtable returns results, whereas tha second and subsequent calls fail with 403. I find no differences in the requests (they're build with the same code anyway), so I'm stuck.

    Thanks for your help in advance!

    Regards,

    Sönke

     

    The two requests and the responses:

    First request: All entites

    GET http://127.0.0.1:10002/devstoreaccount1/Contacts HTTP/1.1
    x-ms-date: Thu, 20 Oct 2011 12:49:44 GMT
    x-ms-version: 2009-09-19
    Content-Type: application/atom+xml
    DataServiceVersion: 1.0;NetFx
    MaxDataServiceVersion: 1.0;NetFx
    Authorization: SharedKey devstoreaccount1:pLSsx2fq3pO/ob+CyZTmx3zaTx87G3qjCRfMwvuKTEA=
    Accept: application/atom+xml,application/xml
    Host: 127.0.0.1:10002

    First response:

    HTTP/1.1 200 OK
    Cache-Control: no-cache
    Transfer-Encoding: chunked
    Content-Type: application/atom+xml;charset=utf-8
    Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
    x-ms-version: 2009-09-19
    Date: Thu, 20 Oct 2011 12:49:45 GMT

    322A
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <feed xml:base="http://127.0.0.1:10002/devstoreaccount1/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
      <title type="text">Contacts</title>
      <id>http://127.0.0.1:10002/devstoreaccount1/Contacts</id>
      <updated>2011-10-20T12:49:45Z</updated>
      <link rel="self" title="Contacts" href="Contacts" />
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A07.867Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='A',RowKey='Anna_fb11726f-e920-4ae0-9cae-473f2e7b7d20')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='A',RowKey='Anna_fb11726f-e920-4ae0-9cae-473f2e7b7d20')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>A</d:PartitionKey>
            <d:RowKey>Anna_fb11726f-e920-4ae0-9cae-473f2e7b7d20</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:07.867Z</d:Timestamp>
            <d:CellPhone>425-555-0101</d:CellPhone>
            <d:City>Redmond</d:City>
            <d:Email>anna@contoso.com</d:Email>
            <d:FirstName>Anna</d:FirstName>
            <d:HomePhone>425-555-0111</d:HomePhone>
            <d:LastName>Anderson</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>101 Alder</d:StreetAddress>
            <d:ZipCode>58052</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-09-02T17%3A05%3A15.923Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='B',RowKey='Bob_2d11a910-a007-46af-9d28-ebaa4aefbdab')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='B',RowKey='Bob_2d11a910-a007-46af-9d28-ebaa4aefbdab')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>B</d:PartitionKey>
            <d:RowKey>Bob_2d11a910-a007-46af-9d28-ebaa4aefbdab</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-09-02T17:05:15.923Z</d:Timestamp>
            <d:CellPhone>425-555-0102</d:CellPhone>
            <d:City>Oyten0</d:City>
            <d:Email>bob@contoso.com</d:Email>
            <d:FirstName>Bob</d:FirstName>
            <d:HomePhone>425-555-0122</d:HomePhone>
            <d:LastName>Brown</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>202 Beech</d:StreetAddress>
            <d:ZipCode>58006</d:ZipCode>
            <d:MODDATE>'2011-09-02T19:05:15'</d:MODDATE>
            <d:MODSYSTEM>NEMEXSIMPLEWINLOCAL</d:MODSYSTEM>
            <d:MODUSER>PRIES</d:MODUSER>
            <d:VERSIONID>6</d:VERSIONID>
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A08.097Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='C',RowKey='Chloe_a399f407-2725-4d56-8e51-7961ddcb6274')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='C',RowKey='Chloe_a399f407-2725-4d56-8e51-7961ddcb6274')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>C</d:PartitionKey>
            <d:RowKey>Chloe_a399f407-2725-4d56-8e51-7961ddcb6274</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:08.097Z</d:Timestamp>
            <d:CellPhone>425-555-0103</d:CellPhone>
            <d:City>Kirkland</d:City>
            <d:Email>chloe@contoso.com</d:Email>
            <d:FirstName>Chloe</d:FirstName>
            <d:HomePhone>425-555-0133</d:HomePhone>
            <d:LastName>Clark</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>303 Chestnut</d:StreetAddress>
            <d:ZipCode>58033</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A08.133Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='D',RowKey='Daniel_bafbd561-9c84-43c9-8f62-7ca0e2fadc63')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='D',RowKey='Daniel_bafbd561-9c84-43c9-8f62-7ca0e2fadc63')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>D</d:PartitionKey>
            <d:RowKey>Daniel_bafbd561-9c84-43c9-8f62-7ca0e2fadc63</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:08.133Z</d:Timestamp>
            <d:CellPhone>425-555-0104</d:CellPhone>
            <d:City>Redmond</d:City>
            <d:Email>daniel@contoso.com</d:Email>
            <d:FirstName>Daniel</d:FirstName>
            <d:HomePhone>425-555-0144</d:HomePhone>
            <d:LastName>Davis</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>404 Dogwood</d:StreetAddress>
            <d:ZipCode>58052</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A08.16Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='E',RowKey='Emma_41c5a34f-747e-495f-9f6f-9ad84b1d3d67')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='E',RowKey='Emma_41c5a34f-747e-495f-9f6f-9ad84b1d3d67')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>E</d:PartitionKey>
            <d:RowKey>Emma_41c5a34f-747e-495f-9f6f-9ad84b1d3d67</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:08.16Z</d:Timestamp>
            <d:CellPhone>425-555-0105</d:CellPhone>
            <d:City>Bellevue</d:City>
            <d:Email>emma@contoso.com</d:Email>
            <d:FirstName>Emma</d:FirstName>
            <d:HomePhone>425-555-0155</d:HomePhone>
            <d:LastName>Evans</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>505 Elm</d:StreetAddress>
            <d:ZipCode>58007</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A08.243Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='F',RowKey='Francisco_dd0262f0-cadb-4447-9c05-3223dbaead28')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='F',RowKey='Francisco_dd0262f0-cadb-4447-9c05-3223dbaead28')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>F</d:PartitionKey>
            <d:RowKey>Francisco_dd0262f0-cadb-4447-9c05-3223dbaead28</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:08.243Z</d:Timestamp>
            <d:CellPhone>425-555-0106</d:CellPhone>
            <d:City>Kirkland</d:City>
            <d:Email>francisco@email.com</d:Email>
            <d:FirstName>Francisco</d:FirstName>
            <d:HomePhone>425-555-0166</d:HomePhone>
            <d:LastName>Flores</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>606 Fir</d:StreetAddress>
            <d:ZipCode>58034</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A08.27Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='G',RowKey='Grace_765ca781-b68f-4845-9cc1-e87d38023f05')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='G',RowKey='Grace_765ca781-b68f-4845-9cc1-e87d38023f05')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>G</d:PartitionKey>
            <d:RowKey>Grace_765ca781-b68f-4845-9cc1-e87d38023f05</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:08.27Z</d:Timestamp>
            <d:CellPhone>425-555-0107</d:CellPhone>
            <d:City>Redmond</d:City>
            <d:Email>grace@contoso.com</d:Email>
            <d:FirstName>Grace</d:FirstName>
            <d:HomePhone>425-555-0177</d:HomePhone>
            <d:LastName>Green</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>707 Ginkgo</d:StreetAddress>
            <d:ZipCode>58052</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
      <entry m:etag="W/&quot;datetime'2011-08-02T10%3A14%3A08.297Z'&quot;">
        <id>http://127.0.0.1:10002/devstoreaccount1/Contacts(PartitionKey='H',RowKey='Hunter_75ea9ad9-82c5-4186-91e3-2eb850324000')</id>
        <title type="text"></title>
        <updated>2011-10-20T12:49:45Z</updated>
        <author>
          <name />
        </author>
        <link rel="edit" title="Contacts" href="Contacts(PartitionKey='H',RowKey='Hunter_75ea9ad9-82c5-4186-91e3-2eb850324000')" />
        <category term="devstoreaccount1.Contacts" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <content type="application/xml">
          <m:properties>
            <d:PartitionKey>H</d:PartitionKey>
            <d:RowKey>Hunter_75ea9ad9-82c5-4186-91e3-2eb850324000</d:RowKey>
            <d:Timestamp m:type="Edm.DateTime">2011-08-02T10:14:08.297Z</d:Timestamp>
            <d:CellPhone>425-555-0108</d:CellPhone>
            <d:City>Bellevue</d:City>
            <d:Email>hunter@contoso.com</d:Email>
            <d:FirstName>Hunter</d:FirstName>
            <d:HomePhone>425-555-0188</d:HomePhone>
            <d:LastName>Harris</d:LastName>
            <d:State>WA</d:State>
            <d:StreetAddress>808 Hemlock</d:StreetAddress>
            <d:ZipCode>58004</d:ZipCode>
            <d:MODDATE m:null="true" />
            <d:MODSYSTEM m:null="true" />
            <d:MODUSER m:null="true" />
            <d:VERSIONID m:null="true" />
            <d:CREDATE m:null="true" />
            <d:CREUSER m:null="true" />
            <d:CRESYSTEM m:null="true" />
          </m:properties>
        </content>
      </entry>
    </feed>
    0

    Second request: Reload of two certain entities:

    GET http://127.0.0.1:10002/devstoreaccount1/Contacts()?$filter=((PartitionKey%20eq%20'A')%20and%20(RowKey%20eq%20'Anna_fb11726f-e920-4ae0-9cae-473f2e7b7d20'))%20or%20((PartitionKey%20eq%20'B')%20and%20(RowKey%20eq%20'Bob_2d11a910-a007-46af-9d28-ebaa4aefbdab')) HTTP/1.1
    x-ms-date: Thu, 20 Oct 2011 12:49:45 GMT
    x-ms-version: 2009-09-19
    Content-Type: application/atom+xml
    DataServiceVersion: 1.0;NetFx
    MaxDataServiceVersion: 1.0;NetFx
    Authorization: SharedKey devstoreaccount1:0WiM3tbcncB1vzNvLZULY6X8FlrmqrrCtAIG41jBORw=
    Accept: application/atom+xml,application/xml
    Host: 127.0.0.1:10002

    Second response:

    HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    Content-Length: 356
    Content-Type: application/xml
    Server: Microsoft-HTTPAPI/2.0
    Date: Thu, 20 Oct 2011 12:49:45 GMT

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code>AuthenticationFailed</code>
      <message xml:lang="en-US">Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.</message>
    </error>


    Donnerstag, 20. Oktober 2011 13:20

Antworten

  • Sorry, Guys,

     

    found the problem: It was a hard-to-see Typo in the method for creating the authorisation header. So the error message was 100% correct... ;-)

    Thanks anyway!

     

    Regards, Soenke

    • Als Antwort markiert Sönke Pries Dienstag, 25. Oktober 2011 15:10
    Dienstag, 25. Oktober 2011 15:10