与Google API服务帐户共享打印机

时间:2020-12-15 15:34:26

Is it possible to share a GCP printer with a Google API service account (https://developers.google.com/accounts/docs/OAuth2ServiceAccount)?

是否可以与Google API服务帐户(https://developers.google.com/accounts/docs/OAuth2ServiceAccount)共享GCP打印机?

I tried to share the printer with the client email address (id@developer.gserviceaccount.com), but the printer is not shown in the response to the API call /search.Calling /submit leads to an error (User has no access)

我尝试使用客户端电子邮件地址(id@developer.gserviceaccount.com)共享打印机,但是在API调用/search的响应中未显示打印机。调用/提交导致错误(用户无法访问)

2 个解决方案

#1


I believe you are encountering the "is pending" problem. Namely, you did share your printer with the "id@developer.gserviceaccount.com" account but the other user (in this case "id@developer.gserviceaccount.com") has to accept the invitation to share the printer. You can check this by issuing the /print request and you will see an

我相信你遇到了“正在等待”的问题。也就是说,您确实与“id@developer.gserviceaccount.com”帐户共享了您的打印机,但另一个用户(在这种情况下为“id@developer.gserviceaccount.com”)必须接受共享打印机的邀请。你可以通过发出/ print请求来检查这个,你会看到一个

"is_pending": true

element in the access section for your user - "id@developer.gserviceaccount.com" in this case.Needles to say that accounts that have this element set to true cannot print - hence the "User is not authorized." message. I know no way to accept the invitation for the given service account however there is a workaround. You can create a private google group with an account that can accept shared printers (e.g. your gmail account). Then you add the service account ("id@developer.gserviceaccount.com") to the group et voila. You can print with the service account ;). When you share the printer you must share it with the google group (use the group's email address which you can find somewhere in the group management console) and the group manager (e.g. your gmail account) must accept the invitation for the whole group. More info on how to create the group can be found here. I have tried this with a GAE service account and it works. If you need any clarification do not hesitate to ask. Good luck.

在这种情况下,您的用户访问部分中的元素 - “id@developer.gserviceaccount.com”。需要说明将此元素设置为true的帐户无法打印 - 因此“用户未被授权”。信息。我知道无法接受给定服务帐户的邀请,但有一种解决方法。您可以使用可以接受共享打印机的帐户(例如您的Gmail帐户)创建一个私人Google群组。然后将服务帐户(“id@developer.gserviceaccount.com”)添加到组et voila。您可以使用服务帐户打印;)。共享打印机时,您必须与谷歌小组共享(使用您可以在群组管理控制台中找到的群组电子邮件地址),群组管理员(例如您的Gmail帐户)必须接受整个群组的邀请。有关如何创建组的更多信息,请访问此处。我已尝试使用GAE服务帐户,但它确实有效。如果您需要任何澄清,请不要犹豫。祝好运。

#2


As you yourself shared the printer with the service account, we can assume you know the "Printer ID" of the printer to which the service account has been invited.

当您自己与服务帐户共享打印机时,我们可以假设您知道已邀请服务帐户的打印机的“打印机ID”。

Have the service account call the /processinvite request, with these (mandatory) parameters:

让服务帐户使用以下(必需)参数调用/ processinvite请求:

  • printerid = the-known-printer-id
  • printerid = the-known-printer-id

  • accept = true
  • accept = true

After that, the printer will appear in /search

之后,打印机将出现在/ search中

Happy printing!

#1


I believe you are encountering the "is pending" problem. Namely, you did share your printer with the "id@developer.gserviceaccount.com" account but the other user (in this case "id@developer.gserviceaccount.com") has to accept the invitation to share the printer. You can check this by issuing the /print request and you will see an

我相信你遇到了“正在等待”的问题。也就是说,您确实与“id@developer.gserviceaccount.com”帐户共享了您的打印机,但另一个用户(在这种情况下为“id@developer.gserviceaccount.com”)必须接受共享打印机的邀请。你可以通过发出/ print请求来检查这个,你会看到一个

"is_pending": true

element in the access section for your user - "id@developer.gserviceaccount.com" in this case.Needles to say that accounts that have this element set to true cannot print - hence the "User is not authorized." message. I know no way to accept the invitation for the given service account however there is a workaround. You can create a private google group with an account that can accept shared printers (e.g. your gmail account). Then you add the service account ("id@developer.gserviceaccount.com") to the group et voila. You can print with the service account ;). When you share the printer you must share it with the google group (use the group's email address which you can find somewhere in the group management console) and the group manager (e.g. your gmail account) must accept the invitation for the whole group. More info on how to create the group can be found here. I have tried this with a GAE service account and it works. If you need any clarification do not hesitate to ask. Good luck.

在这种情况下,您的用户访问部分中的元素 - “id@developer.gserviceaccount.com”。需要说明将此元素设置为true的帐户无法打印 - 因此“用户未被授权”。信息。我知道无法接受给定服务帐户的邀请,但有一种解决方法。您可以使用可以接受共享打印机的帐户(例如您的Gmail帐户)创建一个私人Google群组。然后将服务帐户(“id@developer.gserviceaccount.com”)添加到组et voila。您可以使用服务帐户打印;)。共享打印机时,您必须与谷歌小组共享(使用您可以在群组管理控制台中找到的群组电子邮件地址),群组管理员(例如您的Gmail帐户)必须接受整个群组的邀请。有关如何创建组的更多信息,请访问此处。我已尝试使用GAE服务帐户,但它确实有效。如果您需要任何澄清,请不要犹豫。祝好运。

#2


As you yourself shared the printer with the service account, we can assume you know the "Printer ID" of the printer to which the service account has been invited.

当您自己与服务帐户共享打印机时,我们可以假设您知道已邀请服务帐户的打印机的“打印机ID”。

Have the service account call the /processinvite request, with these (mandatory) parameters:

让服务帐户使用以下(必需)参数调用/ processinvite请求:

  • printerid = the-known-printer-id
  • printerid = the-known-printer-id

  • accept = true
  • accept = true

After that, the printer will appear in /search

之后,打印机将出现在/ search中

Happy printing!