質問

i used two codes and its not working the first one :

    <?php
  require_once('fb/facebook.php');
  $config = array(
    'appId' => 'xxxxx',
    'secret' => 'xxxxx',
  );

  $facebook = new Facebook($config);
  $user_id = $facebook->getUser();
?>
<html>
  <head></head>
  <body>

  <?php
      function render_login($facebook) {
          $canvas_page = 'http://fbbost.eb2a.com/';
          // HERE YOU ASK THE USER TO ACCEPT YOUR APP AND SPECIFY THE PERMISSIONS NEEDED BY
          $login_url = $facebook->getLoginUrl(array('scope'=>'email,user_photos,friends_photos', 'redirect_uri'=>$canvas_page));
          echo 'Please <a href="' . $login_url . '">login.</a>';
      }

    if($user_id) {
      try {

        $user_profile = $facebook->api('/me','GET');
        echo "Name: " . $user_profile['name'];

      } catch(FacebookApiException $e) {
        render_login($facebook);
        echo "1";
        error_log($e->getType());
        error_log($e->getMessage());
      }
    } else {
       render_login($facebook);
       echo "2";
    }
  ?>

  </body>
    </html>

and the second one :

<html>
<head>
<title>NNN</title>
</head>
<body>
<?php
include "fb/facebook.php";
$facebook=new Facebook(array(
  'appId' => 'xxxxx',
  'secret' => 'xxxxx',
  'cookie' => true
));

$session=$facebook->getUser();
$me=null;

if($session){
  try{
    $me=$facbook->api('/me');
    print_r($me);
  }
  catch (FacebookApiException $e){
    echo $e->getMessage();
  }
}

if($me){
  $logoutUrl=$facbook->getLogoutUrl();
  echo "<a href='$logoutUrl'>Logout</a>";
}
else{
  $loginUrl=$facebook->getLoginUrl(array(
    'scope' => 'publish_stream,read_friendlists'
  ));
  echo "<a href='$loginUrl'>Login</a>";
}

?>
</body>
</html>

both codes return the same error when i login : App Not Setup: The developers of this app have not set up this app properly for Facebook Login.

役に立ちましたか?

解決

I think your app is not public. You need to set it to public to use it with any Facebook account other than the developer's own account. Go to "Status and Review" and make the app public.

Besides, check that you have properly setup the app domain.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top