yasirsiddiqui / php-google-cloud-print

PHP class to print documents using Google Cloud Print with OAuth2 authorization
91 stars 42 forks source link

I am getting User credentials required Error 403 #15

Closed vinaymcp closed 9 years ago

vinaymcp commented 9 years ago

when ever i am trying to access the offlineAccess.php, it asks for the permission and generates the token and then send's me to example.php, but then on example.php if i do a print_r($gcp);

it just shows the below log.

I am not sure why its giving me the error : User credentials required Error 403. Any help will be appreciated.

Thanks in advance.

Array ( [0] => Authorization: Bearer 1/jyrDbwVWLUjCl56GXfh3h9-g5IKjJf8VM8bGmRjkT1p [1] => X-CloudPrint-Proxy: Google-JS [2] => Accept-Charset: utf-8 [3] => Authorization: GoogleLogin auth 1/jyrDbwVWLUjCl56GXfh3h9-g5IKjJf8VM8bGmRjkT1p ) GoogleCloudPrint Object ( [authtoken:GoogleCloudPrint:private] => 1/jyrDbwVWLUjCl56GXfh3h9-g5IKjJf8VM8bGmRjkT1p [httpRequest:GoogleCloudPrint:private] => HttpRequest Object ( [httpResponse] => User credentials required

Error 403

[ch] => Resource id #4 ) [refreshtoken:GoogleCloudPrint:private] => ) ./pdf.pdf

yasirsiddiqui commented 9 years ago

Offline access is used where user is not present. So when you get token on offlineToken.php then you need to use cron.php. Example.php is for online access. Once you got the token then you need to update following line on cron.php

$refreshTokenConfig['refresh_token'] = 'YOUR-OFFLINE-ACCESS-TOKEN'; and script will work fine.