0

I'm trying to implement an unploading of image to amazon s3 using only rest api. I've seen their docs but the problem is I'm only using temporary credential which will expire for about an hour. Below is the response

{
 accessKey: "mykey"
 secretKey: "mysecret"
 token: "mytemptoken"
 expiry: 1381128021000
}

My policy

POLICY_JSON = { "expiration": "2013-12-03T12:29:27.000Z",
            "conditions": [
                    ["eq", "$bucket", this.get('bucket')],
                    ["starts-with", "$key", this.get('key')],
                    {"acl": this.get('acl')},
                    {"success_action_redirect": this.get('successActionRedirect')},
                    ["starts-with", "$Content-Type", this.get('contentType')]
            ]
          };

Here what I tried so far: Using chrome advance rest client I entered this url: https://mybucket.s3.amazonaws.com/avatars/test@domain.com with headers of

Authorization: AWS mykey:CXp5qqO6q552VDYUI0aBlSd/pTs=
x-amz-security-token: mytemptoken
x-amz-date: Mon, 07 OCt 2013 06:20:37 GMT

The result was: 403 Forbidden and its saying SignatureDoesNotMatch. Does anyone able to accomplish uploading of object using only Rest Api of s3 (not using of SDK's). The client asked me if its possible to build it using only javascript. Is this possible?

4

1 回答 1

1

您不应该签署内容吗? 检查此如何签名。签名后,您必须在 Authorization 标头中传递签名值。

授权:AWS AWSAccessKeyId:Signature

于 2013-10-07T07:03:23.803 回答