2012-09-07 104 views
1

我无法弄清楚,为什么Facebook的发布是不是在这个网站API错误说明:会话密钥无效或不再有效(错误102)

我得到

API错误代码的工作:102 API错误说明:会话密钥无效或不再有效 错误信息:I帧对话必须与主要会话被称为

虽然调用stream.publish方法的iframe

<script type="text/javascript"> 

    (function() { 
     var e = document.createElement('script'); e.async = true; 
     e.src = document.location.protocol 
     + '//connect.facebook.net/fr_FR/all.js'; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 


    window.fbAsyncInit = function() 
    { 
     FB.init({  appId: '303380259758621', 
      status: true, 
      channelUrl: 'http://www.crabegame.com/channel.php', 
      cookie: true, 
      xfbml: true, 
      oauth: true}); 

    } 


    function PublishStream(score) 
    { 
     FB.ui(
     { 
      method: 'stream.publish', 
      display : 'iframe', 
      message : '', 
      attachment: 
      { 
      name: 'CrabeGame', 
      caption: 'Essaye de battre mon score sur le Crabe Game !', 
      description: "J'ai réalisé un score de " + score + "points au Crabe Game !", 
      href: 'http://www.crabegame.com', 
      media: 
      [ 
       { 
       type: 'image', 
       src: 'http://crabegame.com/media/crabe_fb.png', 
       href: 'http://www.crabegame.com' 
       } 
      ] 
      }, 
      action_links: 
      [ 
      { 
       text: 'Play Crabe Game', 
       href: 'http://www.crabe-game.com' 
      } 
      ], 
      user_message_prompt: 'Publier sur votre mur' 
     }, 
     function (response) 
     { 
      if (response && response.post_id) 
      { 

      } 
     } 
     ); 
    } 
</script> 
+0

[这个问题](http://stackoverflow.com/questions/7373355/api-error-code-102-javascript-dialogs-with-php )并且接受的答案可能是相关的。 – nickie

回答

0

这意味着您没有当前用户。为了调用PublishStream试试这个:

 FB.login(function(response) { 
     if (response.authResponse) { 
      PublishStream(); 
     } else { 
      console.log('Not logged in'); 
     } 
     }); 
+0

这是错误的,你不需要登录使用fb.ui提要对话框 – luschn

-1

你鸵鸟政策需要登录的用户,只需删除显示:“IFRAME”,为我工作。它仍然会显示在iframe中,但没有错误。不要问我为什么,1:1的应用程序设置与我的另一个应用程序中的显示值一起工作......至少对于我来说,apprequest对话框的工作原理可能与此相同。

我会使用“feed”而不是“stream.publish”。

在这里看到:https://developers.facebook.com/docs/reference/dialogs/feed/

也:Using Like Button and FB.ui (apprequests) On the Same Page Conflicts

+0

为什么downvotes?例如,不推荐使用stream.publish。所以至少我的一些信息是正确的。 – luschn

相关问题