You are here

public function FacebookAuthManager::authenticate in Social Auth Facebook 3.x

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

Authenticates the user.

Overrides OAuth2ManagerInterface::authenticate

File

src/FacebookAuthManager.php, line 47

Class

FacebookAuthManager
Contains all the logic for Facebook OAuth2 authentication.

Namespace

Drupal\social_auth_facebook

Code

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