2

I'm trying to create a share button with facebook javascript SDK :

  • On Facebook Developer Page - Facebook Login - Valid OAuth redirect URIs
    I have added my dev URL : http://localhost:5000/

I have added this code to my page

    window.fbAsyncInit = function() {
    FB.init({
      appId      : 'my app id xxxxxxxxxxxxx',
      xfbml      : true,
      version    : 'v2.6'
    });
  };

  (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/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));

    $('.btnShare').click(function () {
        FB.ui({
            method: 'feed',
            link: "http://localhost:5000/",
            picture: 'http://localhost:5000/src/assets/image.JPG',
            name: "The name who will be displayed on the post",
            description: "The description who will be displayed"
        }, function (response) {
            console.log(response);
        });
    });

I click on the share button and an iframe opens and it throws this error:

Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

Any ideas ?

Tiberiu Popescu
  • 4,486
  • 2
  • 26
  • 38

1 Answers1

1

As described here, you will probably need to tweak your settings in facebook a bit.

Community
  • 1
  • 1
Andreas Gnyp
  • 1,500
  • 1
  • 19
  • 25