Loading...
 
Features / Usability

Features / Usability


Re: Social Login unable to auto create user

posts: 400

Try this:

Replace this (around lines 221 - 230 in lib/socialnetworkslib.php):

// try cURL
$url = 'https://graph.facebook.com' . $url;
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$ret = curl_exec($ch);
curl_close($ch);


With this:

// try ZendOAuth
$this->options['callbackUrl'] = $this->getURL();
$this->options['requestTokenUrl'] = 'https://graph.facebook.com/' . $this->graphVersion . '/oauth/access_token';
$consumer = new ZendOAuth\Consumer($this->options);
$httpClient = TikiLib::lib('tiki')->get_http_client();
$consumer->setHttpClient($httpClient);
$customServiceParameters = [
	'client_id' => $prefs['socialnetworks_facebook_application_id'],
	'client_secret' => $prefs['socialnetworks_facebook_application_secr'],
	'redirect_uri' => $this->getURL(),
	'code' => $_REQUEST['code']
];
/** @var ZendOAuth\Token\Request $token */
$token = $consumer->getRequestToken($customServiceParameters);
$resp = $token->getResponse();
$ret = $resp->getContent();