You are here

public function GoogleAnalyticsCounterFeed::createAuthUrl in Google Analytics Counter 7.3

Create a URL to obtain user authorization. The authorization endpoint allows the user to first authenticate, and then grant/deny the access request.

Parameters

string $client_id:

Return value

string

1 call to GoogleAnalyticsCounterFeed::createAuthUrl()
GoogleAnalyticsCounterFeed::beginAuthentication in ./google_analytics_counter_oauth2.lib.inc
Begin authentication by allowing the user to grant/deny access to the Google account

File

./google_analytics_counter_oauth2.lib.inc, line 102
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 createAuthUrl($client_id, $redirect_uri) {
  $params = array(
    'response_type=code',
    'redirect_uri=' . $redirect_uri,
    'client_id=' . urlencode($client_id),
    'scope=' . self::SCOPE,
    'access_type=offline',
    'approval_prompt=force',
  );
  $params = implode('&', $params);
  return self::OAUTH2_AUTH_URL . "?{$params}";
}