You are here

public function LinkedInAuthManager::requestEndPoint in Social Auth LinkedIn 8.2

Same name and namespace in other branches
  1. 3.x src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager::requestEndPoint()

File

src/LinkedInAuthManager.php, line 72

Class

LinkedInAuthManager
Contains all the logic for LinkedIn OAuth2 authentication.

Namespace

Drupal\social_auth_linkedin

Code

public function requestEndPoint($method, $path, $domain = NULL, array $options = []) {
  if (!$domain) {
    $domain = 'https://api.linkedin.com';
  }
  $url = $domain . $path;
  $request = $this->client
    ->getAuthenticatedRequest($method, $url, $this
    ->getAccessToken(), $options);
  try {
    return $this->client
      ->getParsedResponse($request);
  } catch (IdentityProviderException $e) {
    $this->loggerFactory
      ->get('social_auth_linkedin')
      ->error('There was an error when requesting ' . $url . '. Exception: ' . $e
      ->getMessage());
  }
  return NULL;
}