SATıŞ: 1-800-867-1389

 none
Blob Upload returns Forbidden

    Soru

  • Hi,

    I am trying to upload a Blob to Azure, ~naked~ binary blob upload succeeds, however, when I add metadata to the Blob I get 'Forbidden' as the Http response code.

    Stepping through the code it seems like only the http header is being signed using the 'Subscriber Id', the algorithm used is "HMACSHA256".

    I am using the Azure Android SDK / Java.

    The following is the NetworkMonitor dump of the HTTP req:

     

    PUT /media-container/Clip10.mp4 HTTP/1.1
    Host: porter.blob.core.windows.net:80
    Connection: close
    Authorization: SharedKey porter:4m/C4HpRIVrxfgXbfmpmxtER85UIACCB7noFWmPqlPk=
    x-ms-blob-type: BlockBlob
    x-ms-version: 2009-09-19
    x-ms-meta-profile: Exclusive
    Content-Length: 2247960
    Accept-Charset: UTF-8
    x-ms-date: Sat, 08 Oct 2011 10:58:14 GMT
    x-ms-meta-category: Entertainment
    x-ms-content-type: application/octet-stream
    
    

     

    This is the response I get:

    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: 800
    Content-Type: application/xml
    Server: Microsoft-HTTPAPI/2.0
    x-ms-request-id: 522893dd-c6e6-4575-96f6-1fbf40f10d30
    Date: Sat, 08 Oct 2011 10:57:59 GMT
    Connection: close
    <?xml version="1.0" encoding="utf-8"?>
    <Error>
    <Code>AuthenticationFailed</Code>
    <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature..RequestId:522893dd-c6e6-4575-96f6-1fbf40f10d30.Time:2011-10-08T10:57:59.9420029Z</Message>
    <AuthenticationErrorDetail>The MAC signature found in the HTTP request '4m/C4HpRIVrxfgXbfmpmxtER85UIACCB7noFWmPqlPk=' is not the same as any computed signature. Server used following string to sign: 'PUT...2247960.........x-ms-blob-type:BlockBlob.x-ms-content-type:application/octet-stream.x-ms-date:Sat, 08 Oct 2011 10:58:14 GMT.x-ms-meta-category:Entertainment.x-ms-meta-profile:Exclusive.x-ms-version:2009-09-19./porter/media-container/Clip10.mp4'.</AuthenticationErrorDetail>
    </Error>
    

    The strange thing is that when I omit the metadata nodes 'x-ms-meta-category' and 'x-ms-meta-profile' the blob uploads successfuly, I suspect this is related with signing logic though while debugging through it was verified that the metadata is included...

    Any help will be appreciated

     


    Nadav Rubinstein, See my Blog @ http://www.sophin.com

    • Düzenleyen Nadav Rub 08 Ekim 2011 Cumartesi 11:08
    08 Ekim 2011 Cumartesi 11:04

Yanıtlar

  • Problem resolved!!!

    This seems to be a bug with the Android SDK, this is specific for metadata with attributes having empty values, such attributes are used to generate the signature/SharedKey, BUT, R omitted from the HTTP PUT header, and thus, the signed shared key doesn't match the header used resulting authentication failure.


    Nadav Rubinstein, See my Blog @ http://www.sophin.com
    08 Ekim 2011 Cumartesi 12:19

Tüm Yanıtlar