You are here

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

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

Authenticates the user.

Overrides OAuth2ManagerInterface::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());
  }
}