Loading...
 
Features / Usability

Features / Usability


Re: Re: Social Login unable to auto create user

posts: 400

Please paste the code between "START NEW CODE" and "END NEW CODE" between the lines indicated that should come before and after the new block (it's around line 199 in lib/socialnetworkslib.php). Let me know if that works and please let me know any error messages you receive.

*****************

global $prefs, $user;
$userlib = TikiLib::lib('user');

// code parameter provided by Facebook is already in the url
///////////////// START NEW CODE //////////////////////
$url = '/' . $this->graphVersion . '/oauth/access_token?client_id='
. $prefs['socialnetworks_facebook_application_id'] . '&redirect_uri=' . $this->getURL() . '&client_secret=' . $prefs['socialnetworks_facebook_application_secr'];
//try socket first
$fp = fsockopen('ssl://graph.facebook.com', 443, $errno, $errstr);
if ($fp) {
$request = "GET $url HTTP/1.1\r\n" .
"Host: graph.facebook.com\r\n" .
"Accept: */*\r\n" .
"Expect: 100-continue\r\n" .
"Connection: close\r\n\r\n";

fputs($fp, $request);
$ret = '';
while (! feof($fp)) {
$ret .= fgets($fp, 128);
}
fclose($fp);
$ret = preg_split('/(\r\n\r\n|\r\r|\n\n)/', $ret, 2);
$ret = $ret[1];
} else {
// 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);
}
$json_decoded_ret = json_decode($ret, true);
////////// END NEW CODE //////////////////////
if (isset($json_decoded_ret['access_token']) || substr($ret, 0, 13) == 'access_token=') {

There are no comments at this time.

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting