identity.v1beta1.devices create 403 error

huangapple go评论117阅读模式
英文:

identity.v1beta1.devices create 403 error

问题

我正在尝试使用这个资源创建一个新设备:

https://cloud.google.com/identity/docs/reference/rest/v1beta1/devices/create

我已经像下面这样定义了 API 的范围。

  1. @Override
  2. protected List<String> getScopes() {
  3. return Collections.singletonList(
  4. "https://www.googleapis.com/auth/cloud-identity"
  5. );
  6. }

我正在这样调用 API 的创建方法。

  1. val createDeviceRequest = new CreateDeviceRequest()
  2. .setCustomer("customers/my_customer")
  3. .setDevice(createDeviceModel.toGoogle());
  4. cloudIdentityClientFactory
  5. .createFor(adminGoogleId)
  6. .devices()
  7. .create(createDeviceRequest)
  8. .execute();

"createDeviceRequest" 实体的值如下:

identity.v1beta1.devices create 403 error

关于创建客户端没有错误,因为创建客户端正常工作,并且我能够调用列表终端点并在响应正文中获得成功响应,其中包含 3 个设备。我理解范围正常工作,因为我只使用了上面定义的 1 个范围,并且我可以访问列出设备的权限。

https://cloud.google.com/identity/docs/reference/rest/v1beta1/devices/list

一个正常工作的列出设备的示例:

  1. val x = cloudIdentityClientFactory
  2. .createFor(adminGoogleId)
  3. .devices()
  4. .list()
  5. .setCustomer("customers/my_customer")
  6. .execute();

当我尝试调用创建终端点时,我收到了 403 禁止错误。我想知道这个禁止消息的原因是什么,是否有任何方法可以修复它。

  1. POST https://cloudidentity.googleapis.com/v1beta1/devices
  2. {
  3. "code" : 403,
  4. "errors" : [ {
  5. "domain" : "global",
  6. "message" : "The caller does not have permission",
  7. "reason" : "forbidden"
  8. } ],
  9. "message" : "The caller does not have permission",
  10. "status" : "PERMISSION_DENIED"
  11. }

谢谢。

英文:

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.

  1. @Override
  2. protected List&lt;String&gt; getScopes() {
  3. return Collections.singletonList(
  4. &quot;https://www.googleapis.com/auth/cloud-identity&quot;
  5. );
  6. }

I am calling the API create method like this.

  1. val createDeviceRequest = new CreateDeviceRequest()
  2. .setCustomer(&quot;customers/my_customer&quot;)
  3. .setDevice(createDeviceModel.toGoogle());
  4. cloudIdentityClientFactory
  5. .createFor(adminGoogleId)
  6. .devices()
  7. .create(createDeviceRequest)
  8. .execute();

"createDeviceRequest" entity value is like this:

identity.v1beta1.devices create 403 error

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:

  1. val x = cloudIdentityClientFactory
  2. .createFor(adminGoogleId)
  3. .devices()
  4. .list()
  5. .setCustomer(&quot;customers/my_customer&quot;)
  6. .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.

  1. POST https://cloudidentity.googleapis.com/v1beta1/devices
  2. {
  3. &quot;code&quot; : 403,
  4. &quot;errors&quot; : [ {
  5. &quot;domain&quot; : &quot;global&quot;,
  6. &quot;message&quot; : &quot;The caller does not have permission&quot;,
  7. &quot;reason&quot; : &quot;forbidden&quot;
  8. } ],
  9. &quot;message&quot; : &quot;The caller does not have permission&quot;,
  10. &quot;status&quot; : &quot;PERMISSION_DENIED&quot;
  11. }

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.

huangapple
  • 本文由 发表于 2020年8月21日 20:51:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/63523272.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定