Ошибка диалогового окна JavaScript SDK приложения Iframe (код 102) - PullRequest
1 голос
/ 02 марта 2012

У меня проблема с диалоговым окном публикации через javascript SDK.Иногда это работает, иногда нет.

Выдает эту ошибку:

Код ошибки API: 102 Описание ошибки API: ключ сеанса недействителен или больше не действителен.вызывается с помощью ключа сеанса

Мой код:

  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : 'CENSORED', // App ID
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true  // parse XFBML
      });

      // wait a moment before showing dialog.
      setTimeout("showbox()", 2 * 1000);
    };

    // Load the SDK Asynchronously
    (function(d){
       var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       d.getElementsByTagName('head')[0].appendChild(js);
     }(document));
  </script>

and

    <script>
     function showbox()
     {                          
          FB.ui(
          {
            display: 'iframe',
            method: 'feed',
            name: 'ASD ASD ASD:',
            link: 'https://apps.facebook.com/XXX/',
            picture: 'https://skvelazabava.eu/XXX/yy.jpg',
            caption: 'Největší alkoholici mezi tvými přáteli jsou:',
            description: ' ',
            properties: [{text:"XXX", href:"https://apps.facebook.com/XXX/"}, 
                         {text:"YYY", href:"https://apps.facebook.com/XXX/"} ], 
            redirect_uri: 'https://url.eu/'
          });
     }                    
    </script>

Что мне нужно сделать, чтобы в диалоговом окне был ключ сеанса.

1 Ответ

2 голосов
/ 21 мая 2012

Это было также для меня, чтобы уточнить для всех, кто сталкивается с этим:

<script>
  window.fbAsyncInit = function() {
    FB.init({
        appId  : '{{facebook_app_id}}',
        app_token : '<%=@access_token%>',
        status     : true,
      });

    FB.getLoginStatus(function(response) {
      console.log(response);

      FB.ui({
        method: 'apprequests',
        message: 'Have you heard about Rell?',
        data: 'invite-to-rell-42',
        display: 'iframe',
        filters: [{name: 'Daaku', user_ids: ['1677846385']}, 'app_non_users', {name: 'Games People', user_ids: [703, 6203644]}]
      });  

    });


  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>
...