Can't fetch data from Facebook SDK
12,475
I tried to update to the latest Facebook-php-SDK and the problem was fixed...
I also had to upload the fb_ca_chain_bundle.crt file.
Author by
Abdou Tahiri
Senior Software Engineer / Programmer Enthusiast / Open Source Contributor / in love with @laravel Contact me : [email protected]
Updated on June 04, 2022Comments
-
Abdou Tahiri almost 2 years
I made a CakePHP plugin for social network authentification using Facebook, Twitter, Google, and LinkedIn. The whole plugin works 100% with no bug or error, but lately I tried to login via Facebook and I found myself unable to fetch data from the API.
Here is what I've done.
AuthController Facebook action
public function facebook(){ $facebookObj = SocialAuth::init('facebook'); $facebookLoginUrl = $facebookObj->getLoginUrl(array('scope' => SocialAuth::getConfig('facebook','permissions'), 'canvas' => 1, 'fbconnect' => 0, 'redirect_uri' => SocialAuth::getConfig('facebook','redirect_uri'))); $this->redirect($facebookLoginUrl); }
AuthController callback action
public function callback(){ $facebookObj = SocialAuth::init('facebook'); $facebookInfo = $facebookObj->getUser(); if ($facebookInfo) { // $facebookInfo always return 0 (it was working before >_<) // .. } }
$facebookInfo debug informations
/app/Plugin/SocialAuth/Controller/AuthsController.php (line 104) object(Facebook) { [protected] sharedSessionID => null [protected] kSupportedKeys => array( (int) 0 => 'state', (int) 1 => 'code', (int) 2 => 'access_token', (int) 3 => 'user_id' ) [protected] DROP_QUERY_PARAMS => array( (int) 0 => 'code', (int) 1 => 'state', (int) 2 => 'signed_request' ) [protected] appId => '503845519711145' [protected] appSecret => '--secret--' [protected] user => (int) 0 [protected] signedRequest => null [protected] state => '59e2aba0d18dcc166d8c4aef0f1668c9' [protected] accessToken => '{app-id}|{app-secret}' [protected] fileUploadSupport => false [protected] trustForwarded => false [protected] allowSignedRequest => false }
How can I fix this problem?