I am using Google API with Drive API and Drive Activity API to handle and make changes to files.
Everything seems to work fine, but at random day of the week I receive an invalid_grant
error. I have read about timezone solutions and other 8-9 issues, but I think this is something else.
This is how I work with API:
So it works fine, but this invalid_grant error ruins everything. I have no idea what to do with this.
if you check the documentation for expiration you will find the cause of your issue.
A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days.
Set your app to production in Google developer console and your refresh tokens will last longer then seven days.