How to avoid 'Failed to retrieve access token: { “error” : “invalid_grant” }' in offline GAE cron tasks?
This post is a followup to How to make 'access_type=offline' / server-only OAuth2 operations on GAE/Python . The http = credentials.authorize(httplib2.Http()) part no longer fails when testing, but it seems it still does when run by GAE's cron, where it's unable to refresh my access_token : I can manually run my job by calling /fetch , say at 11:45. Scheduling immediately a /cronfetch job at 11:55 works then , without any access_token issue. But then, I woke up this morning seeing that the same /cronfetch task (same except the timing, which is at 01:00 for my non-test daily task) failed: I