Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在angularjs中访问aws s3中的私有文件_Javascript_Angularjs_Amazon S3 - Fatal编程技术网

Javascript 如何在angularjs中访问aws s3中的私有文件

Javascript 如何在angularjs中访问aws s3中的私有文件,javascript,angularjs,amazon-s3,Javascript,Angularjs,Amazon S3,如何使用api密钥和密码访问angularjs中aws.s3中的私有文件 我有登录api密钥和密码,文件是私有的, 我需要使用angularjs在浏览器中显示文件 当我尝试它时 <Error> <Code>AccessDenied</Code> <Message>Access Denied</Message> <RequestId>8645A4E13B8C1FA5</RequestId> <HostId&g

如何使用api密钥和密码访问angularjs中aws.s3中的私有文件

我有登录api密钥和密码,文件是私有的, 我需要使用angularjs在浏览器中显示文件

当我尝试它时

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

更改存储桶策略

{
  "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/*"
     }
   ]
}