You are here

public function GoogleAuthManager::authenticate in Social Auth Google 8.2

Same name and namespace in other branches
  1. 8 src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::authenticate()
  2. 3.x src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::authenticate()

File

src/GoogleAuthManager.php, line 38

Class

GoogleAuthManager
Contains all the logic for Google OAuth2 authentication.

Namespace

Drupal\social_auth_google

Code

public function authenticate() {
  try {
    $this
      ->setAccessToken($this->client
      ->getAccessToken('authorization_code', [
      'code' => $this->request->query
        ->get('code'),
    ]));
  } catch (IdentityProviderException $e) {
    $this->loggerFactory
      ->get('social_auth_google')
      ->error('There was an error during authentication. Exception: ' . $e
      ->getMessage());
  }
}