public function GoogleAnalyticsCounterFeed::revokeToken in Google Analytics Counter 7.3
OAuth step #1: Fetch request token. Revoke an OAuth2 access token or refresh token. This method will revoke the current access token, if a token isn't provided.
Parameters
string|NULL $token The token (access token or a refresh token) that should be revoked.:
Return value
boolean Returns True if the revocation was successful, otherwise False.
File
- ./
google_analytics_counter_oauth2.lib.inc, line 202 - Provides the Google Analytics Counter Feed object type and associated methods. Most of the Google Analytics authentication process is taken over from http://drupal.org/project/google_analytics_reports because all we need here is its Google Analytics…
Class
- GoogleAnalyticsCounterFeed
- GoogleAnalyticsCounterFeed class to authorize access to and request data from the Google Analytics Core Reporting API.
Code
public function revokeToken($token = NULL) {
if (!$token) {
$token = $this->refresh_token ? $this->refresh_token : $this->access_token;
}
$this->response = drupal_http_request(self::OAUTH2_REVOKE_URI, array(
'headers' => array(
'Content-Type' => 'application/x-www-form-urlencoded',
),
'method' => 'POST',
'data' => "token={$token}",
));
if ($this->response->code == 200) {
$this->access_token = NULL;
return true;
}
return false;
}