Search code examples
javascriptfacebookfeed

fb.ui returning post_id in callback but does not actually post


I'm trying to use fb.ui in order to open a dialog so my users will be able to post on their friends wall. i'm trying the most basic sample that facebook has:

<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>

<script> 
  FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});

  function postToFeed() {

    // calling the API ...
    var obj = {
      method: 'feed',
      redirect_uri: 'YOUR URL HERE',
      link: 'https://developers.facebook.com/docs/reference/dialogs/',
      picture: 'http://fbrell.com/f8.jpg',
      name: 'Facebook Dialogs',
      caption: 'Reference Documentation',
      description: 'Using Dialogs to interact with users.'
    };

    function callback(response) {
      document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
    }

    FB.ui(obj, callback);
  }

Everything looks to work great, the callback is called and i see the post_id but when i go into facebook i cant see the actual post on my friend's wall..


Solution

  • I found out what was wrong.. My app was in sandbox mode and therefore i did get the post_id but the app didn't really post.