public function GoogleAuthManager::authenticate in Social Auth Google 3.x
Same name and namespace in other branches
- 8.2 src/GoogleAuthManager.php \Drupal\social_auth_google\GoogleAuthManager::authenticate()
- 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_googleCode
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());
  }
}