Search code examples
phpfacebookauthenticationfacebook-php-sdkuserid

cannot to connect to facebook with PHP SDK3.2.3


According to countless examples and variations of this on the internet, this should work. I have read many similar cases and comments but have not found a clear answer. This does print an access token but fails to authenticate. echo $user always returns 0. I am suspicious there is some configuration issue on http://developers.facebook.com where you get the appID, something in those settings I haven't got quite right. Thanks for any help.

<?  
require 'src/facebook.php';  

 $facebook = new Facebook(array(  

 'appId'  => '{appID}',  
 'secret' => '{secret}',  
 'cookie' =>  'true',
 'baseurl' => 'http://{baseUrl}'  

  ));  

  $user = $facebook->getUser() ;  
  echo $user;  
  print $facebook->getAccessToken();  
?>  

Solution

  • I fiddled with the settings on the developers.facebook.com long enough I finally found a combination that worked.at this time I can connect and post to my facebook account when I run the app on localhost, why it doesnt work on the webserver is another question.