Home:ALL Converter>Google plus api not valid access token exception

Google plus api not valid access token exception

Ask Time:2012-02-18T00:11:29         Author:ArVan

Json Formatter

I'm working with Google+ API and here's what I got. I know that the access token may become invalid in case of the user uninstalling App or de-authorizing it. But I couldn't find how to handle that case. Is it going to throw an exception? If so, what exact exception (maybe someone knows the code)? I thought that it might be possible to get an http error code like 404 (unauthorized)? If it is, how do I get it? Here is some code:

try {
   $me = $plus->people->get('me')
} catch (Exception $e) {
     // Maybe do something with the error code from $e->getCode();
}

Or check the code obtained from I don't know where:

if($code == 401) {
    throw new Exception('Expired access token detected. Mailing to admin.', 0);
}

Author:ArVan,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/9331655/google-plus-api-not-valid-access-token-exception
yy