yasirsiddiqui / php-google-cloud-print

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

Refresh Token Expires problem #40

Closed krystian-rzepa closed 4 years ago

krystian-rzepa commented 4 years ago

Hi, I generate an access key, everything works, but it expires after about 30 minutes. I want to use this as a cron for printing every few hours so I want to set the key expiration for e.g. 1 year. I found something like this: https://cloud.google.com/apigee/docs/api-platform/antipatterns/oauth-long-expiration but i don't know how to apply it. Thanks for your help in advance.

yasirsiddiqui commented 4 years ago

For Offline Access (when you want to send prints without user presence) hit offlineAccess.php

I would recommend that new offline mode, but you have to go through the processes once, and theoretically if Google ever kills the authentication.

krystian-rzepa commented 4 years ago

For Offline Access (when you want to send prints without user presence) hit offlineAccess.php

I would recommend that new offline mode, but you have to go through the processes once, and theoretically if Google ever kills the authentication.

I hit offlineAccess.php, I made a authentication, replaced token in drukowanie.php (my copy of cron.php file), but after about 30min-1h a get an arror: Fatal error: Uncaught Exception: Please first login to Google in /www/wwwroot/test-site/drukowanie/GoogleCloudPrint.php:123 Stack trace: #0 /www/wwwroot/test-site/drukowanie/drukowanie.php(48): GoogleCloudPrint->getPrinters() #1 {main} thrown in /www/wwwroot/test-site/drukowanie/GoogleCloudPrint.php on line 123

krystian-rzepa commented 4 years ago

https://stackoverflow.com/questions/63710145/cloudprint-php-refresh-token-expires-problem