Our Google Drive authentication has been working nicely for some years until a recent migration of our moodle site to a different server. Many things on the new server are different to the old one, but the moodle code was not changed at all. The new server is running:
- Ubuntu (instead of Gentoo)
- Apache version 2.4.6
- MySQL version 5.5.35
- PHP version 5.5.3
- JSON version 1.3.1
We got this error with full debugging turned on:
Error code: generalexceptionmessage
- line 154 of /lib/google/auth/Google_OAuth2.php: Google_AuthException thrown
- line 104 of /lib/google/auth/Google_OAuth2.php: call to Google_OAuth2->setAccessToken()
- line 132 of /lib/google/Google_Client.php: call to Google_OAuth2->authenticate()
- line 121 of /repository/googledocs/lib.php: call to Google_Client->authenticate()
- line 62 of /repository/repository_callback.php: call to repository_googledocs->callback()
In the end, I discovered that in lilb/google/io/Google_CurlIO.php, the $headerSize on line 207 was too large, therefore truncating the $responseBody text (starting the text part way through). However, if I reduced the $headerSize by 40 characters, everything is now working. eg.
$headerSize = $headerSize - 40;
I'm wondering if anyone else has come across this yet? Is it the latest version of PHP do you think? Because the moodle code didn't change, and still works perfectly on an older server, so I'm presuming the google api hasn't changed.
I'd love someone else's ideas here, as my fix feels pretty flaky, but I had hundreds of students who suddenly could not submit their assignments via their google drive.
Thanks in advance!