Вопрос

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();  
?>  
Это было полезно?

Решение 2

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.

Другие советы

a snippet of your code,

'baseurl' => 'http://mizu.net46.net/src/facebook.php' 

baseurl must not be facebook.php it should be

'baseurl' => 'http://example.com/myApp/CallbackFile.php'

remember to match baseurl with your website/site URL in your app dashboard

sample of site url setting

duplicates (further reading):

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top