Facebook在all.js中分享问题

时间:2015-12-21 12:20:51

标签: javascript facebook

我正在使用以下代码登录并将内容分享到Facebook。

.login(function(response) {
  //console.log(response);
        if (response.authResponse) {
        console.log(response);
            testAPI(eventId);
            fbShare();
       }else{
       FB.login();
       }
    }, {scope: 'publish_actions'});
    var fbShare = function() 
    {
    FB.ui({
        method: "feed",
        display: "iframe",
        link: url,
        caption: title,
        description: summary,
        picture: image
    });
};

window.fbAsyncInit = function() {  

FB.init({
  appId      : 'XXXXXXXXXXXXXXXX' ,  
  channelUrl : 'http://ilovesalesevents.in/', 
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true, 
  oauth  : true  ,  // enable OAuth 2.0 // parse XFBML
  version    : 'v2.5' // use version 2.2
});

isLoaded = true;

// Additional initialization code here
  };

     // 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));

function testAPI(eventId) {

FB.api('/me', function(response) {
     console.log(response);

    if(response.id=="undefined")
         FB.login();

    else{       

    } 
      // console.log('Good to see you, ' + response.name + '.');
    });
}

我可以在Facebook登录,在登录控制台后我收到错误 screenshot

0 个答案:

没有答案