英文:
identity.v1beta1.devices create 403 error
问题
我正在尝试使用这个资源创建一个新设备:
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"
);
}
我正在这样调用 API 的创建方法。
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 禁止错误。我想知道这个禁止消息的原因是什么,是否有任何方法可以修复它。
POST https://cloudidentity.googleapis.com/v1beta1/devices
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "The caller does not have permission",
"reason" : "forbidden"
} ],
"message" : "The caller does not have permission",
"status" : "PERMISSION_DENIED"
}
谢谢。
英文:
I am trying to create a new device with this resouce:
https://cloud.google.com/identity/docs/reference/rest/v1beta1/devices/create.
I have defined the scopes for the API like below.
@Override
protected List<String> getScopes() {
return Collections.singletonList(
"https://www.googleapis.com/auth/cloud-identity"
);
}
I am calling the API create method like this.
val createDeviceRequest = new CreateDeviceRequest()
.setCustomer("customers/my_customer")
.setDevice(createDeviceModel.toGoogle());
cloudIdentityClientFactory
.createFor(adminGoogleId)
.devices()
.create(createDeviceRequest)
.execute();
"createDeviceRequest" entity value is like this:
There is no error about creating the client because creating the client works fine and I am able to call the list endpoint and get success response with 3 devices in the response body. I understand that the scope works fine because I am only using the 1 scope defined above and I have access to the listing devices.
https://cloud.google.com/identity/docs/reference/rest/v1beta1/devices/list
An example for the listing devices which works fine:
val x = cloudIdentityClientFactory
.createFor(adminGoogleId)
.devices()
.list()
.setCustomer("customers/my_customer")
.execute();
When I try to call the create endpoint I get a 403 Forbidden error. I want to know about what's the cause of this forbidden message and is there any way to fix it.
POST https://cloudidentity.googleapis.com/v1beta1/devices
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "The caller does not have permission",
"reason" : "forbidden"
} ],
"message" : "The caller does not have permission",
"status" : "PERMISSION_DENIED"
}
Thanks.
答案1
得分: 1
我建议您将您的问题发布在Github上。
他们可能会更有能力回答您与Java和GCP API有关的问题。
英文:
I would recommend you post your question on Github instead.
They will probably better equipped to answer your question related to Java and the GCP API.
答案2
得分: 0
创建新设备时,您必须拥有企业标准、企业增强、教育版企业以及云身份高级许可证才能创建设备。最好购买这些许可证,然后重试。
英文:
To create a new device you must need Enterprise Standard, Enterprise Plus, Enterprise for Education, and Cloud Identity Premium licenses to create a device. Better buy those licenses and try again.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论