php - Google OAuth2 - isAccessTokenExpired() always true -


i use oauth in application , want log out user when access token expired.

but when checked token expiration with

 $client->isaccesstokenexpired() 

it return 1.

if (isset($_get['logout'])) {     unset($_session['token']); }   if (isset($_get['code'])) {     $client->authenticate($_get['code']);     $_session['token'] = $client->getaccesstoken();     $redirect = 'http://' . $_server['http_host'] . $_server['php_self'];     header('location: ' . filter_var($redirect, filter_sanitize_url));   }    if (!isset($_session['token'])) {     $authurl = $client->createauthurl();  }   if (isset($_session['token'])) {     $client->setaccesstoken($_session['token']);     $service = new google_service_calendar($client);      $oauth2 = new google_service_oauth2($client);     $userinfo = $oauth2->userinfo->get();     $emailuser = $userinfo->getemail();     $_session['emailuser'] = $userinfo->getemail(); } 

you checking expiration before running $client->setaccesstoken();. let see code checking expiration.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -