You are here

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

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

Request and end point.

Parameters

string $method: The HTTP method for the request.

string $path: The path to request.

string|null $domain: The domain to request.

array $options: Request options.

Return value

array|mixed Data returned by provider.

Overrides OAuth2ManagerInterface::requestEndPoint

File

src/LinkedInAuthManager.php, line 82

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;
}