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