Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /includes/Google/Auth/OAuth2.php:330
.
A few days of testing, experiments, “googling” Internet, and miscellaneous shamanic dances with a tambourine around “Google APIs Client Library for PHP” source code and the sample example of its usage did not allow me to make even a little step forward. Trying various variants with service-account.php (recreate service account, replacing private key file, trying other, default service account with client secret loading from JSON file) did not help and I still was on the same place with the same error. That was funny to resolve finally this issue and smile to myself, how the small mistake at very begin may cost a lot of time to fix it.