You are here

public function LinkedInAuthManager::authenticate in Social Auth LinkedIn 3.x

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

Authenticates the user.

Overrides OAuth2ManagerInterface::authenticate

File

src/LinkedInAuthManager.php, line 40

Class

LinkedInAuthManager
Contains all the logic for LinkedIn OAuth2 authentication.

Namespace

Drupal\social_auth_linkedin

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_linkedin')
      ->error('There was an error during authentication. Exception: ' . $e
      ->getMessage());
  }
}