Google cloud print API integration in my application

398 Views Asked by At

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

There are 1 best solutions below

0
Anirudh Saria On

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, [email protected])

Then try calling GCP APIs. It will work perfectly.