You are here

public function OpenIDConnectAutoDiscover::fetch in OpenID Connect / OAuth client 2.x

Returns request response.

Parameters

string $base_url: The well-known configuration base URL.

string $path: The relative path of the well-known configuration.

Return value

array|bool A result array or FALSE.

File

src/OpenIDConnectAutoDiscover.php, line 53

Class

OpenIDConnectAutoDiscover
OpenID Connect well-known URI discovery service.

Namespace

Drupal\openid_connect

Code

public function fetch(string $base_url, string $path = '.well-known/openid-configuration') {
  try {
    $response = $this->client
      ->fromOptions([
      'base_uri' => $base_url,
    ])
      ->get($path);
    return Json::decode($response
      ->getBody());
  } catch (RequestException $e) {
    $this->logger
      ->warning('The auto discover URL %url seems to be broken because of error "%error".', [
      '%url' => $base_url,
      '%error' => $e
        ->getMessage(),
    ]);
    return FALSE;
  }
}