I am using the Google PHP client library. I successfully receive the token and update the token from the / google user for use with the API. As soon as the user cancels the permission for my site in the Google settings on the Google page, I get the following error:
Error calling GET https://www.googleapis.com/calendar/v3/users/me/calendarList: (401) Invalid Credentials
This is an expected behavior as the user revoked my permission. However, how do you determine if the user has canceled this access?
I am currently doing the following to find out if I have access:
$gclient->setAccessToken($token);
if ($gclient->getAccessToken())
Well, this code, unfortunately, does not detect the revoked permission. How can I handle this?
source
share