You are here

public function GoogleAuthController::redirectToGoogle in Social Auth Google 8

Redirect to Google Services Authentication page.

Return value

\Zend\Diactoros\Response\RedirectResponse Redirection to Google Accounts.

1 string reference to 'GoogleAuthController::redirectToGoogle'
social_auth_google.routing.yml in ./social_auth_google.routing.yml
social_auth_google.routing.yml

File

src/Controller/GoogleAuthController.php, line 87

Class

GoogleAuthController
Manages requests to Google API.

Namespace

Drupal\social_auth_google\Controller

Code

public function redirectToGoogle() {

  /* @var \Google_Client $client */
  $client = $this->networkManager
    ->createInstance('social_auth_google')
    ->getSdk();
  $client
    ->setScopes([
    'email',
    'profile',
  ]);
  return new RedirectResponse($client
    ->createAuthUrl());
}