2012-03-26 91 views
0

我嘗試使用facebook-php-sdk提供登錄。但是,當我點擊登錄鏈接Facebook的把我這個消息:「一個錯誤發生,請稍後再試」如何使用facebook-php-sdk提供Facebook登錄?

<?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> 

我嘗試與Facebook的JS-SDK來管理,但我得到了同樣的錯誤。

在此先感謝。

+0

可能重複嘗試這個http://stackoverflow.com/questions/7231939/redirecting-to-authentication-dialog-an-error-occurred-please-try-again-late – 2012-03-26 12:55:42

回答

2
+0

我發現了一個解決方案,我在「選擇你的應用如何與Facebook集成」一章下啓用了我的網站的Facebook登錄。 感謝jalso的幫助! – gperriard 2012-03-29 09:33:55