You are here

public function GAFeed::getAccessToken in Google Analytics Counter 7.2

OAuth step #3: Fetch access token.

File

./GAFeed.lib.inc, line 139
Provides the GAFeed object type and associated methods.

Class

GAFeed
GAFeed class to authorize access to and request data from the Google Analytics Data Export API.

Code

public function getAccessToken() {
  $this
    ->setHost($this->oAuthHost);
  $this
    ->setQueryPath('accounts/OAuthGetAccessToken');
  $params = array(
    'oauth_verifier' => $this->verifier,
  );
  $this
    ->query($this->queryPath, $params, 'GET', array(
    'refresh' => TRUE,
  ));
  parse_str($this->response->data, $token);
  $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
  return $token;
}