简体   繁体   English

用户可以不经身份验证直接将文件上传到Google Cloud Storage吗?

[英]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.

相关问题 将缓冲区直接上传到 Google Cloud Storage - Upload Buffer Directly to Google Cloud Storage 如何在没有 JavaScript 令牌的情况下将文件上传到谷歌云存储 - How can I upload files to google cloud storage without token in JavaScript 允许用户在php中上传文件到云存储 - allow users to upload files to cloud storage in php Google Cloud Storage - 如何直接从浏览器上传内容 (JavaScript) - Google Cloud Storage - How to Upload content directly from browser (JavaScript) 尝试将文件从网页上传到Google Cloud Storage - Trying to upload files from a webpage to Google Cloud Storage 使用PHP将文件上传到Google Cloud Storage Bucket - Upload files to Google Cloud Storage Bucket using PHP 在没有文件的情况下将 JSON 字符串上传到 Google Cloud Storage - Upload JSON string to Google Cloud Storage without a file 在来自 Google Cloud Storage 的 javascript 中未经授权列出存储桶中的文件 - List files in a bucket without authorisation in javascript from Google Cloud Storage CSV阵列直接到Google Cloud Storage - CSV Array directly to Google Cloud Storage 如何直接将文件写入Google云端存储而不将其保存在我的应用程序中? - How to write a file to Google Cloud Storage directly without saving it in my application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM