You are here

public function OAuth2Manager::getExtraDetails in Social Auth 8.2

Same name and namespace in other branches
  1. 3.x src/AuthManager/OAuth2Manager.php \Drupal\social_auth\AuthManager\OAuth2Manager::getExtraDetails()

Request data from the declared endpoints.

Parameters

string $method: The HTTP method for the request.

string|null $domain: The domain to request.

Return value

array|null The extra details gotten from provider.

Overrides OAuth2ManagerInterface::getExtraDetails

File

src/AuthManager/OAuth2Manager.php, line 38

Class

OAuth2Manager
Defines a basic OAuth2Manager.

Namespace

Drupal\social_auth\AuthManager

Code

public function getExtraDetails($method = 'GET', $domain = NULL) {
  $endpoints = $this
    ->getEndPoints();

  // Stores the data mapped with endpoints define in settings.
  $data = [];
  if ($endpoints) {

    // Iterates through endpoints define in settings and retrieves them.
    foreach (explode(PHP_EOL, $endpoints) as $endpoint) {

      // Endpoint is set as path/to/endpoint|name.
      $parts = explode('|', $endpoint);
      $data[$parts[1]] = $this
        ->requestEndPoint($method, $parts[0], $domain);
    }
    return $data;
  }
  return NULL;
}