如何在angularjs

时间:2016-12-08 13:17:36

标签: javascript angularjs amazon-s3

如何使用api KEY和SECRET访问angularjs中aws.s3中的私有文件

我有登录api密钥和密码,文件是私有的, 我需要使用angularjs

在我的浏览器中显示该文件

当我尝试时给出

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>8645A4E13B8C1FA5</RequestId>
<HostId>
0EnuTRDbQ38bVSYORlj8qdpNXxC38LMmsv8n0aMEgiE1LxKImuHKejnSFHtyaBQqEXj9guXOUww=
</HostId>
</Error>

1 个答案:

答案 0 :(得分:1)

{
  "Version":"2012-10-17",
  "Id":"http referer policy example",
  "Statement":[
    {
      "Sid":"Allow get requests originating from www.example.com and example.com.",
      "Effect":"Allow",
      "Principal":"*",
      "Action":"s3:GetObject",
      "Resource":"arn:aws:s3:::examplebucket/*",
      "Condition":{
        "StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
      }
    }
  ]
}

{
   "Version":"2012-10-17",
   "Id":"PolicyForCloudFrontPrivateContent",
   "Statement":[
     {
       "Sid":" Grant a CloudFront Origin Identity access to support private content",
       "Effect":"Allow",
       "Principal":{"CanonicalUser":"79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"},
       "Action":"s3:GetObject",
       "Resource":"arn:aws:s3:::example-bucket/*"
     }
   ]
}

更改广告系列政策