Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSRF Token Validation Failed Google Cloud Print

How to obtain XSRF Token in Google Cloud Print?

When I tried to submit job print. It's always get message "XSRF Token Validation Failed.".

I've checked in "Inspect Elements" in http://www.google.com/cloudprint/simulate.html. And there's a hidden text input with name 'xsrf'.

How to obtain XSRF Token?

like image 452
Dhinx Avatar asked Oct 21 '22 06:10

Dhinx


1 Answers

I had problems with this too, and came here because I couldn't find the answer in Google's API documentation. If someone else needs an XSRF token for Google Cloud Print, this is wat worked for me.

First you have to get an OAuth2 access token from Google with the following scope enabled:

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

After that, you can make a call to www.google.com/cloudprint/xsrf with Authorization: Bearer YOUR_ACCESS_TOKEN in the header.

With cURL that would look like this:

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" www.google.com/cloudprint/xsrf

Good luck.

like image 114
piscator Avatar answered Nov 15 '22 07:11

piscator