如何解决identity.v1beta1.devices创建403错误
我正在尝试使用这种资源来创建新设备:
https://cloud.google.com/identity/docs/reference/rest/v1beta1/devices/create。
我已经定义了API的范围,如下所示。
@Override
protected List<String> getScopes() {
return Collections.singletonList(
"https://www.googleapis.com/auth/cloud-identity"
);
}
val createDeviceRequest = new CreateDeviceRequest()
.setCustomer("customers/my_customer")
.setDevice(createDeviceModel.toGoogle());
cloudIdentityClientFactory
.createFor(adminGoogleId)
.devices()
.create(createDeviceRequest)
.execute();
“ createDeviceRequest”实体值如下:
创建客户端没有错误,因为创建客户端可以正常工作,并且我可以调用列表终结点并在响应正文中使用3个设备获得成功响应。我知道该范围很好,因为我仅使用上面定义的1个范围,并且可以访问列表设备。
https://cloud.google.com/identity/docs/reference/rest/v1beta1/devices/list
一个可以正常工作的列表设备示例:
val x = cloudIdentityClientFactory
.createFor(adminGoogleId)
.devices()
.list()
.setCustomer("customers/my_customer")
.execute();
当我尝试调用创建端点时,出现403 Forbidden错误。我想知道此禁止消息的原因是什么,有什么办法可以解决它。
POST https://cloudidentity.googleapis.com/v1beta1/devices
{
"code" : 403,"errors" : [ {
"domain" : "global","message" : "The caller does not have permission","reason" : "forbidden"
} ],"status" : "PERMISSION_DENIED"
}
谢谢。
解决方法
我建议您改为发布问题on Github。
他们可能会更好地回答您有关Java和GCP API的问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。