public function Oauth::getClient in Entity Share 8.3
Prepares a guzzle client for http operations with the supported auth.
Parameters
string $url: The url to set in the client.
Return value
\GuzzleHttp\Client The HTTP client.
Overrides ClientAuthorizationInterface::getClient
File
- modules/
entity_share_client/ src/ Plugin/ ClientAuthorization/ Oauth.php, line 132
Class
- Oauth
- Provides Oauth2 based client authorization.
Namespace
Drupal\entity_share_client\Plugin\ClientAuthorizationCode
public function getClient($url) {
$token = $this
->getAccessToken($url);
return $this->httpClientFactory
->fromOptions([
'base_uri' => $url . '/',
'allow_redirects' => TRUE,
'headers' => [
'Authorization' => 'Bearer ' . $token,
],
]);
}