【发布时间】:2022-11-11 08:54:27
【问题描述】:
从 Google Cloud Shell 中,我尝试调用访问范围指定为“dataplansharing”here 的 Google API。
卷曲
-X 发布
-H "授权: Bearer $(/home/kannanj/.local/bin/oauth2l fetch dataplansharing)"
-H“内容类型:应用程序/json”
-lhttps://mobiledataplansharing.googleapis.com/v1/operators/11344/planStatuses?userKey=Xfqom7Xm1rAJVabp0Gv7wTZ186ia37L29Cefehfu
-d '{“请求”:“回声”}'
{
“错误”: {
“代码”:403,
"message": "请求的身份验证范围不足。",
“状态”:“PERMISSION_DENIED”,
“细节”: [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
“原因”:“ACCESS_TOKEN_SCOPE_INSUFFICIENT”,
“域”:“googleapis.com”,
“元数据”:{
“服务”:“mobiledataplansharing.googleapis.com”,
“方法”:“google.mobile.dataplansharing.v1.MobileDataPlanSharingService.CreatePlanStatus”
}
}
]
}
}
它提示了拨款,我接受了。但调用失败如上。知道为什么吗?请注意,在这种用法中,我直接使用 Shell,如果我从 VM 实例运行,则不涉及服务帐户模拟。我尝试的方法不受支持吗?
【问题讨论】: