You are here

public function GoogleAuthManager::getAuthorizationUrl in Social Auth Google 3.x

Same name and namespace in other branches
  1. 8.2 src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::getAuthorizationUrl()

Returns the authorization URL where user will be redirected.

Return value

string|mixed Absolute authorization URL.

Overrides OAuth2ManagerInterface::getAuthorizationUrl

File

src/GoogleAuthManager.php, line 67

Class

GoogleAuthManager
Contains all the logic for Google OAuth2 authentication.

Namespace

Drupal\social_auth_google

Code

public function getAuthorizationUrl() {
  $scopes = [
    'email',
    'profile',
  ];
  $extra_scopes = $this
    ->getScopes();
  if ($extra_scopes) {
    $scopes = array_merge($scopes, explode(',', $extra_scopes));
  }

  // Returns the URL where user will be redirected.
  return $this->client
    ->getAuthorizationUrl([
    'scope' => $scopes,
  ]);
}