简体   繁体   English

通过Public API访问Google云端存储分区的正确方法

[英]Right way to access the Google Cloud Storage bucket via Public API

I'm trying the following request to access the bucket by using curl, via the public API: 我正在尝试使用curl通过公共API访问存储桶的以下请求:

curl -X POST -H 'Content-Type: image/jpeg' -d @xxx.jpeg 'https://www.googleapis.com/upload/storage/v1/b/clips.xxx.xxx/o?uploadType=media&name=x.jpeg&key=XXX'

With XXX being the generated key in the Public API. 使用XXX是Public API中生成的密钥。

However I'm getting an authorization failure: 但是我收到授权失败:

{ "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } } {“error”:{“errors”:[{“domain”:“global”,“reason”:“required”,“message”:“Login Required”,“locationType”:“header”,“location”:“授权“}],”代码“:401,”消息“:”需要登录“}}

Seems the request is incorrect and does not pass the authorization key, any idea what would be the right form of the request? 似乎请求不正确并且没有传递授权密钥,任何想法什么是正确的请求形式?

That's your API key, not an authorization key. 这是您的API密钥,而不是授权密钥。 See Authorization in the documentation. 请参阅文档中的授权 You need to use OAuth. 您需要使用OAuth。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 对谷歌云存储的非交互式访问 - Non-interactive access to google cloud storage 在 Google Cloud 上运行 bash 脚本以批量下载到 Bucket 的最佳方式 - Best way to run bash script on Google Cloud to bulk download to Bucket 将大文件(使用可恢复上传)上传到Google云存储桶时遇到问题 - Having trouble uploading large file (using resumable upload) into google cloud storage bucket 如何使用Curl和API密钥上传到Google云端存储? - How do I upload to Google Cloud Storage with Curl and an API key? 如何通过curl访问Google Chart API? - How to access google chart api via curl? 基于密钥/令牌的长寿方式来下载带有curl的Google存储桶对象? - Long lived key/token based way to download google storage bucket objects with curl? 通过API使用共享网址(AuthKey)访问Google文档? - Access a Google Doc via API with a shared URL (AuthKey)? 在 Google Cloud Storage 中创建“文件夹”对象 - creating a “folder” object in Google Cloud Storage 谷歌云存储卷曲PHP上传 - google cloud storage curl php upload 尽管可与CURL一起使用,但无法通过解析云代码访问Dropbox API - Could not access Dropbox API via parse cloud code although works with CURL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM