2016-10-12 8 views
0

こんにちは私はページの負荷のボタンのようなFacebookから好きなら取得したいです。私は、user_likes権限を持つfbグラフapiをうまく動作させようとしています。私はfacebookからこの許可を得ることはできません。私たちのアプリは現在の機能に対してこの許可を必要としていないと言いました。ユーザーが好きなような許可なしにページの読み込みに好きな、または好きではないことができますか? user_likes権限を持つコード例を示します。facebook JS SDKでページが読み込まれたページを取得するには?

window.fbAsyncInit = function() { 
FB.init({ 
    appId  : 'xxxxxxx', 
    status  : true, 
    xfbml  : true 
}); 
FB.Event.subscribe('edge.create', 
    function(response) { 
    window.location.href = 'xyz.com'; 
    } 
); 

FB.Event.subscribe('edge.remove', 
    function(response) { 
    <!-- alert('You UNliked the URL: ' + response); --> 
    window.location.href = 'xxx.com'; 
    } 
); 
FB.getLoginStatus(function(response){ 
     FB.api(
      '/me/likes/xxxxx', 
      'GET', 
      {}, 
      function(response) { 
      if(response.data[0]) 
      { 
       alert(response); 
       window.location.href = 'xyz.com'; 
      } 
      } 
     ); 
    }); 
}; 
(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#xfbml=1&version=v2.7&appId=xxxxxxx"; 
    fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk')); 
+0

は私の答えを参照してください。どのような状況について知っておく必要がありますか?それにはいくつかの重要な限界があり、それが私が求めている理由です。 – luschn

+1

ありがとう、私はいつもdevils-heaven.comに従います。 –

答えて

1

いいえ、あなたはuser_likes権限がないと類似のステータスを取得できません。また、API呼び出しを行う前に、ログイン状態のチェックを考慮する必要があります。

FB.getLoginStatus(function(response) { 
    if (response.status === 'connected') { 
     //user is authorized 
     FB.api(...); 
    } else { 
     //user is not authorized 
    } 
}); 

出典:http://www.devils-heaven.com/facebook-javascript-sdk-login/

関連する問題