Google cloud print API integration in my application

最后都变了- 提交于 2020-01-06 05:52:07

问题


I am trying to integrate Google cloud print in Android Application. I do not want to do it through Print framework as my requirement is to directly print from application without any selection process.

For this, I have integrate Google authentication and generate access token for that. I am trying to load printer list using access_token but getting error all the time.

Following are my API call details:

URL : https://www.google.com/cloudprint/search

Type : POST

Header :

Authorization : OAuth ACCESS_TOKEN

Content-Type : application/json

Error message is:

<HTML>
    <HEAD>
        <TITLE>User credentials required</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
        <H1>User credentials required</H1>
        <H2>Error 403</H2>
    </BODY>
</HTML>

Any help appreciated.


回答1:


Create a google group. Add members by direct invite:

  1. Your gmail account (gmail email address)
  2. Your google service account from which access token was furnished (service account email address)

Then follow the below steps:

  1. Go to google.com/cloudprint
  2. Select your printer and click Share tab. Add following members under invite people:
    • google service account email address
    • google group email address ( eg, xyz@googlegroups.com)

Then try calling GCP APIs. It will work perfectly.



来源:https://stackoverflow.com/questions/52968277/google-cloud-print-api-integration-in-my-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!