Google api 使用谷歌api在谷歌云存储中创建和共享存储桶;s
我需要使用google api在gcloud存储中创建并共享一个存储桶。但我在尝试使用postman(rest客户端)时出错 我在试着和你谈谈Google api 使用谷歌api在谷歌云存储中创建和共享存储桶;s,google-api,google-cloud-storage,postman,google-oauth,Google Api,Google Cloud Storage,Postman,Google Oauth,我需要使用google api在gcloud存储中创建并共享一个存储桶。但我在尝试使用postman(rest客户端)时出错 我在试着和你谈谈 url ------- https://www.googleapis.com/storage/v1/b?project=testproject request body ------------ { "name":"testbucketmanafnew" } 我犯了个错误 { "error": { "errors": [
url
-------
https://www.googleapis.com/storage/v1/b?project=testproject
request body
------------
{
"name":"testbucketmanafnew"
}
我犯了个错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
在iam使用OAuth 2.0创建访问目录之后。并添加到标题中
Authorization = ya29.VALUE_REDACTED
但我犯了个错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
我错过了什么
使用谷歌api浏览器,我能够成功调用api的
POST https://www.googleapis.com/storage/v1/b?project=testproject&key={YOUR_API_KEY}
{
"name": "testmanafcjbucketyy"
}
授权需要按以下方式传递 如果您使用的是邮递员,“Header”字段变为Authorization,“Value”字段变为Bearer[WHITESPACE][oauth2_token]
Authorization: Bearer [oauth2_token]