Example #1
0
 public function updateFromGoogleAccount()
 {
     $client = GoogleSessionController::getClient();
     $oauth2 = new \Google_Auth_OAuth2($client);
     if ($this->google_token && $oauth2->isAccessTokenExpired() == false) {
         $oauth2->refreshToken($this->google_token);
         $client->setAccessToken($oauth2->getAccessToken());
         $oauth2 = new \Google_Service_Oauth2($client);
         $google_user = $oauth2->userinfo->get();
         // update the photo
         GoogleSessionController::saveGoogleProfileImage($google_user, $this);
         // other things later..
         return true;
     }
     return false;
 }