You are here

protected function FacebookAuth::getHttpClient in Social Auth Facebook 8

Returns HTTP client to be used with Facebook SDK.

Facebook SDK v5 uses the following autodetect logic for determining the HTTP client: 1. If cURL extension is loaded, use it. 2. If cURL was not loaded but Guzzle is found, use it. 3. Fallback to FacebookStreamHttpClient.

Drupal 8 ships with Guzzle v6 but Facebook SDK v5 works only with Guzzle v5. Therefore we need to change the autodetect logic so that we're first using cURL and if that is not available, we fallback directly to FacebookStreamHttpClient.

Return value

string Client that should be used with Facebook SDK.

1 call to FacebookAuth::getHttpClient()
FacebookAuth::initSdk in src/Plugin/Network/FacebookAuth.php
Sets the underlying SDK library.

File

src/Plugin/Network/FacebookAuth.php, line 171

Class

FacebookAuth
Defines a Network Plugin for Social Auth Facebook.

Namespace

Drupal\social_auth_facebook\Plugin\Network

Code

protected function getHttpClient() {
  if (extension_loaded('curl')) {
    return 'curl';
  }
  return 'stream';
}