【发布时间】:2020-08-05 12:35:36
【问题描述】:
我在 Google Cloud Platform Auto ML Vision API 中有一个奇怪的情况。当我进行 API 请求时,它总是抛出一个错误,说 PERMISSION DENIED,请参阅下面的示例错误响应:
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
这是我到目前为止所做的:
- 已创建服务帐户并下载包含服务帐户密钥的 json 文件。
- 为我的服务帐号启用了 AutoML Editor 和 AutoML Admin。
-
集成predict rest api并使用以下代码生成不记名令牌:
var credentials: GoogleCredentials = GoogleCredentials .fromStream(context.assets.open("service_account_key.json")) .createScoped(Lists.newArrayList("https://www.googleapis.com/auth/cloud-platform")) credentials.refreshIfExpired() val accesstoken = credentials.accessToken
【问题讨论】:
标签: android kotlin google-cloud-automl automl