title: Revoke Token OAuth 2 google api
body: <p>I want to revoke Token to use it for longer time, my code begins with standart redirect -> getToken flow:</p>
  
  <pre><code>        $code = (array_key_exists('code', $_GET) ? $_GET['code'] : '');
          $access_token = json_decode(DB::getToken(), true);
  
          $guzzleClient = new \GuzzleHttp\Client(array( 'curl' =&gt; array( CURLOPT_SSL_VERIFYPEER =&gt; false, ), ));
          $this-&gt;client = new Google_Client();
          $this-&gt;client-&gt;setHttpClient($guzzleClient);
          $this-&gt;client-&gt;setAuthConfig('client_secret.json');
          $this-&gt;client-&gt;addScope("https://www.googleapis.com/auth/calendar");
          $this-&gt;client-&gt;setAccessType('offline');
          $this-&gt;client-&gt;setApprovalPrompt('force');
          $this-&gt;client-&gt;setAccessToken($access_token);
  
          if(!$code &amp;&amp; !$access_token) {
              $auth_url = $this-&gt;client-&gt;createAuthUrl();
              header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
          }
  
          if($code &amp;&amp; !$access_token) {
              $this-&gt;client-&gt;fetchAccessTokenWithAuthCode($code);
              $access_token = $this-&gt;client-&gt;getAccessToken();
              DB::saveToken($access_token);
          }
  </code></pre>
  
  <p>Right here I check if Access Token is expired, if yes I revoke token and expect to continue using it without problem:</p>
  
  <pre><code>        if($this-&gt;client-&gt;isAccessTokenExpired()) {
              $revoked = $this-&gt;client-&gt;revokeToken($access_token);
              if($revoked) {
                  $access_token = $this-&gt;client-&gt;getAccessToken();
              }
          }
  </code></pre>
  
  <p>Though problem occurs and error I get <code>Token expired or revoked</code> error message.</p>
  
  <p>What I'm doing wrong here ? </p>
  
  <p>I expect after revoking, token to be valid again.</p>