简体   繁体   中英

How to configure my application php sdk (facebook)

I'm trying to create my first login with PHP SDK, apparently I have a bad configuration of the application, I have made a simple code to learn well this SDK but I do not run well, please some help to make this right. Here my sample code:

require_once("src/facebook.php");

$config = array();
$config['appId'] = '{App ID}';

$config['secret'] = '{App Secret}';

$config['fileUpload'] = true;

$facebook = new Facebook($config);

echo $facebook->api('/me');

echo $facebook->getUser();

So far your comment, I think it is facebook app configuration issue.

Logged in to your facebook ie. https://developers.facebook.com . -> Apps ->Open your app in edit mode. Find "Website with Facebook Login". Here put the domain name, from where you are running this app.

http://yourdomain

For development purpose, you can set

http://localhost/

in this textbox.

Also set "App Domains" same as above. Now try again. Hope your problem will be solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM