0

The goal

Share a simple image through the Facebook's wall.

The problem

FB's API Error

Or, if someday the image go offline:

API Error Code: 191

API Error Description: The specified URL is not owned by the application

Error Message: redirect_uri is not owned by the application.


My question is: What I'm doing wrong?

The scenario

Firstly, I loads the Facebook's JavaScript SDK:

<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({
            appId: 'xxx',
            channelUrl: '//localhost/channel.html',
            status: true,
            xfbml: true
        });
    };

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

Secondly, there's the following button on my application:

<a href="#" onClick="publishOnFacebook()">
    <i class="icons icon-facebook-big"></i></a>

The publishOnFacebook() method is:

function publishOnFacebook() {
    FB.ui(
        {
            method: 'feed',
            name: 'Facebook Dialogs',
            link: 'https://developers.facebook.com/docs/dialogs/',
            picture: 'http://fbrell.com/f8.jpg',
            caption: 'Reference Documentation',
            description: 'Dialogs provide a simple, 
                          consistent interface for applications to 
                          interface with users.'
        },
        function(response) {
            if (response && response.post_id) {
                alert('Post was published.');
            } else {
                alert('Post was not published.');
            }
        }
    );
}

And finally, this is my app:

My application on Facebook

Community
  • 1
  • 1
Guilherme Oderdenge
  • 4,935
  • 6
  • 61
  • 96
  • 1
    Change `redirect_uri` to Facebook in-front (a fallback works with any app) & the Link you are trying to share `link: 'https://developers.facebook.com/docs/dialogs/'` is not as you app domain which you specified it in your setting trying changing it to `http://localhost/myHTMl.html` – Adam Azad Sep 16 '13 at 15:43
  • Where do I change the `redirect_uri` as you suggested, @AdamZapp? – Guilherme Oderdenge Sep 16 '13 at 15:55
  • `redirect_uri` is `Site Url` in app setting – Adam Azad Sep 16 '13 at 16:32

1 Answers1

2

Try something like the following.

<script type="text/javascript">
function publishOnFacebook() {
FB.ui(
  {
    method: 'feed',
    name: 'Facebook Dialogs',
    link: 'http://localhost/',
    picture: 'http://fbrell.com/f8.jpg',
    caption: 'Reference Documentation',
    description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);
}
</script>

<a href="#" onClick="publishOnFacebook()">
    <i class="icons icon-facebook-big"></i></a>
Malcolm
  • 784
  • 3
  • 7
  • 20