Facebook API does not match user

4

I minimized my code as little as possible in order to isolate the error. I've already reviewed the forum for a simple answer, but no tips have solved this basic problem.

In the app settings, the only changes I made were to populate the url (localhost: 81 / mb - I already did the file editing and changing the domain and the result was the same) and set in App Center Permissions the Default Activity clause Privacy as Public. Do I need to do anything else?

This is a PHP page:

include_once 'libs/facebook/src/facebook.php';

$facebook = new Facebook(array(
    'appId'  => '###',
    'secret' => '###',
    'cookie' => true
));

$user = $facebook->getUser();

$login_url = $facebook->getLoginUrl();
echo 'Please <a href="' . $login_url . '">login.</a>';

if($user == null) {
    print_r("user null " . $user);
} else {
    print_r("user logged" . $user);
}

While logged in to facebook and using another Chrome tab, the result is "user null 0".

    
asked by anonymous 07.02.2014 / 12:05

1 answer

1

The problem was in the app setup on Facebook. To resolve this, I had to adjust this option:

  

Do you want to make this app and all its features available to the general public?

on the Status & Reviews.

    
07.02.2014 / 14:49