Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google cloud print OAuth scope not found

I'm creating an app that prints out a pdf from the server after it has been generated.

When using google cloud print I keep getting:

User credentials required
Error 403

Note: making this print request in the simulating page works fine, but that's because I'm already logged into my google account.

After doing some research I found out I need to use OAuth to get an access token to send with the request to make a print job.

And every single page I can find tells me to redirect me to: https://www.googleapis.com/auth/cloudprint, which gives me a 404 error, neither can I find it in the google playground, and using any older versions of authentication ends up in the request to sign in being flagged as an attack from a hacker.

Is there any way around this?

like image 740
Paradoxis Avatar asked Sep 27 '14 21:09

Paradoxis


People also ask

What is Google OAuth scope?

About OAuth and OAuth scopes You use Open Authorization (OAuth) to grant permission to third-party services to access a user's account information without exposing the user's password. With OAuth scopes, you can allow apps to request permission to certain user data. Your users must then permit access to the app.

Is scope required for OAuth2?

You don't necessarily need OAuth2 scopes, and you can handle authentication and authorization however you want. But OAuth2 with scopes can be nicely integrated into your API (with OpenAPI) and your API docs.

How do I add a scope to Google console?

Go to the Google API Console OAuth consent screen page. Add required information like a product name and support email address. Click Add Scope. On the dialog that appears, select the scopes your project uses.


1 Answers

I was stuck on this for a while. The docs don't tell you which scope to use or how to use it. I haven't implemented a Google API using OAuth2 yet, so I didn't have an understanding of how the scoping works.

It turns out the scope is just the base API route for CloudPrint.

To make sure your refresh_token or access_token is scoped properly to use the CloudPrint API you need to use have the following string in your scope object:

https://www.googleapis.com/auth/cloudprint

like image 172
Jonathan Avatar answered Sep 27 '22 20:09

Jonathan