[英]Can users upload files directly to Google Cloud Storage without authentication?
I just set up a simple JS photo uploader on my site. 我只是在我的网站上设置了一个简单的JS照片上传器。 It uploads photos directly to a Google Cloud Storage bucket.
它将照片直接上传到Google Cloud Storage存储桶。
I used the code from their official JavaScript library 我使用了他们官方JavaScript库中的代码
But if you look at that code, you'll see that it requires authentication. 但是,如果您查看该代码,就会发现它需要身份验证。 I'm authenticated and able to upload photos, but I want everyone to be able to just upload their files without signing in to their Google Accounts.
我已通过身份验证,可以上传照片,但我希望每个人都可以仅上传其文件而无需登录其Google帐户。
Is that possible? 那可能吗?
You could use a POST policy doc: https://cloud.google.com/storage/docs/xml-api/post-object#policydocument 您可以使用POST政策文档: https : //cloud.google.com/storage/docs/xml-api/post-object#policydocument
This will let you build a signed request with various constraints built in (content-length, content-size, etc.), allowing unauthenticated users to upload to your bucket with the given constraints. 这样一来,您就可以建立具有各种内置限制(内容长度,内容大小等)的签名请求,从而允许未经身份验证的用户使用给定的限制上传到存储桶中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.