You are here

public function GoogleAnalyticsReportsApiFeed::createAuthUrl in Google Analytics Reports 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

$client_id:

$redirect_uri:

Return value

string

1 call to GoogleAnalyticsReportsApiFeed::createAuthUrl()
GoogleAnalyticsReportsApiFeed::beginAuthentication in google_analytics_reports_api/google_analytics_reports_api.lib.inc
Begin authentication.

File

google_analytics_reports_api/google_analytics_reports_api.lib.inc, line 86
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 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}";
}