Is it possible to share a GCP printer with a Google API service account (https://developers.google.com/accounts/docs/OAuth2ServiceAccount)?
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)
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
"is_pending": true
element in the access
section for your user (id@developer.gserviceaccount.com) in this case.
Needless 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:
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.