【问题标题】:Iframe dialogs must be called with a session key必须使用会话密钥调用 iframe 对话框
【发布时间】:2011-12-28 06:25:24
【问题描述】:

我正在尝试致电FB.ui 在 iframe 中制作墙贴。但是,当我将显示设置为 iframe 时,我得到一个 102 error "Iframe dialogs must be called with a session key"。我有一个访问令牌,我已登录,其他一切似乎都在工作(我什至可以使用 PHP 直接发布到流中而无需显示提示)。有什么想法吗?

PHP:

require_once('facebook.php');
define('APP_ID',"276733022359677");
define('APP_SECRET',"xxxx");
$my_url = URI_B."/spider/";

$config = array();
$config['appId'] = APP_ID;
$config['secret'] = APP_SECRET;
$facebook = new Facebook($config);
$fbid = $facebook->getUser();
if($fbid == 0){
    $scope = "";
    header("Location: ".$facebook->getLoginUrl($scope));
}

Javascript:

FB.init({appId: "276733022359677", status: true, cookie: true});
function publish() {
    var obj = {
        display: 'iframe',
        method: 'feed',
        link: 'http://discussiontopic.comyr.com/spider/',
        name: 'Test',
        caption: 'Test Caption',
        description: 'This is a test.'
    };

    FB.ui(obj);
}

我还在登录页面上收到未指定的错误(如果重定向到那里登录)。

【问题讨论】:

    标签: facebook session iframe dialog


    【解决方案1】:

    如果您有用户的访问令牌,请将其指定为FB.ui 调用的参数:

    var obj = {
        display: 'iframe',
        access_token: '<%= $access_token %>',
        method: 'feed',
        link: 'http://discussiontopic.comyr.com/spider/',
        name: 'Test',
        caption: 'Test Caption',
        description: 'This is a test.'
    };
    

    【讨论】:

      猜你喜欢
      • 2016-11-15
      • 2010-11-06
      • 2011-08-24
      • 2011-06-07
      • 2017-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多