public function GoogleAnalyticsReportsApiFeed::revokeToken in Google Analytics Reports 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
boll Returns True if the revocation was successful, otherwise False.
File
- google_analytics_reports_api/
google_analytics_reports_api.lib.inc, line 209 - Provides the Google Analytics Reports API Feed object type and associated methods.
Class
- GoogleAnalyticsReportsApiFeed
- GoogleAnalyticsReportsApiFeed 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->refreshToken ? $this->refreshToken : $this->accessToken;
}
$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->accessToken = NULL;
return TRUE;
}
return FALSE;
}