You are here

public function GAFeed::getAccessToken in Google Analytics Reports 7

Same name and namespace in other branches
  1. 6 GAFeed.lib.inc \GAFeed::getAccessToken()

OAuth step #3: Fetch access token.

File

./GAFeed.lib.inc, line 136
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;
}