0

I try to provide a login with the facebook-php-sdk. But, when I click on the login link facebook throw me this message: "an error occurred. Please try again later"

<?php
require_once('php-sdk/src/facebook.php');

define('APP_ID', 'blabla');
define('APP_SECRET', 'blibli');

$facebook = new Facebook(array(
  'appId'  => APP_ID,
  'secret' => APP_SECRET,
));

$params = array(
  'scope' => 'read_stream, friends_likes',
  'redirect_uri' => 'http://127.0.0.1'
);

$login_url = $facebook->getLoginUrl($params);
$user_id = $facebook->getUser();

?>
<!DOCTYPE html>
<html>
    <head>
        <title>info-intox.tv</title>
        <meta charset="utf-8" />
    </head>
    <body>
    <?php if ($user_id) { ?>
        <form action="index.php" method="post">
            <input type="text" name="txtPostId" />
            <input type="submit" value="Get the CSV file" />
        </form>
    <?php } else { ?>
        <a href="<?php echo $login_url ?>">Login</a>
    <?php } ?>
    </body>
</html>

I try to manage with the facebook-js-sdk but I have got the same error.

Thanks in advance.

gperriard
  • 1,077
  • 2
  • 12
  • 22
  • Possible duplicate try this http://stackoverflow.com/questions/7231939/redirecting-to-authentication-dialog-an-error-occurred-please-try-again-late – jogesh_pi Mar 26 '12 at 12:55

1 Answers1

2
jalso
  • 78
  • 6
  • I found a solution, I enabled the facebook login for my website under the "Select how your app integrates with Facebook" chapter. Thank jalso for your help ! – gperriard Mar 29 '12 at 09:33