0

私はjavascript sdkを使用しています。私はpublish_actionを確認するために既に送信しています。承認されています。Facebook Js Sdk、publish_actionsが動作しない

FB.login(function(response) 
{ 
... 
}, {scope: 'email,publish_actions'}); 

私はリターンエラーを公開しようです:とにかく私は自分の投稿を公開することはできません、私はスコープを要求する方法はこれです

(#200) The user hasn't authorized the application to perform this action 

それが原因でFacebookのモーダルで、本当ですログインは、プロファイルの情報を読み取るためのアクセス許可のみが表示され、公開する許可はありません。私はどのように解決できますか?

EDIT

私は良く説明するために私の完全なコードを追加します。

<script type="text/javascript"> 


/***FACEBOOK***/ 


    function fb_publish_Photo(immaginelink,idfoto){ 
      var testo_share= $("#share_text").text(); 


      var wallPost = { 
       message: testo_share, 
       link:immaginelink, 
       picture:immaginelink 

       }; 
       console.log(wallPost); 
       FB.api('/me/feed', 'post', wallPost , function(response) { 
       if (!response || response.error) { 

        console.log(response.error); 
        alert('Failure! ' + response.error + ' You may logout once and try again'); 


       } else { 
       // alert('Success! Post ID: ' + response.id); 
        var PostId=response.id; 
        if(response.id!=null && response.id!=''){ 

        FB.getLoginStatus(function (response) { 
         if (response.authResponse) { 



         } else { 
          // do something...maybe show a login prompt 
         } 
        }, {scope: 'publish_actions'}); 
        } 
       } 
       console.log(response); 
       }, { scope: 'publish_actions'}); 
    } 

    function statusChangeCallback(response) { 
     console.log('statusChangeCallback'); 
     console.log(response); 
     // The response object is returned with a status field that lets the 
     // app know the current login status of the person. 
     // Full docs on the response object can be found in the documentation 
     // for FB.getLoginStatus(). 
     if (response.status === 'connected') { 
      // Logged into your app and Facebook. 
      //fb_login(); 

     } else if (response.status === 'not_authorized') { 

     } else { 

     } 
     } 

    function fb_login(){ 
     FB.login(function(response) { 

      if (response.authResponse) { 
       console.log('Welcome! Fetching your information.... '); 
       //console.log(response); // dump complete info 
       access_token = response.authResponse.accessToken; //get access token 
       user_id = response.authResponse.userID; //get FB UID 

       FB.api('/me?fields=email,first_name,last_name,name', function(response) { 
        //chiamata ajax per registrare/loggare l'utente 
        console.log(response); 

       }); 

      } else { 
       //user hit cancel button 
       console.log('User cancelled login or did not fully authorize.'); 

      } 
     }, { 
      scope: 'publish_actions' 
     }); 
    } 
     // This function is called when someone finishes with the Login 
     // Button. See the onlogin handler attached to it in the sample 
     // code below. 
     function checkLoginState() { 
     FB.getLoginStatus(function(response) { 
      statusChangeCallback(response); 
     }); 
     } 

     window.fbAsyncInit = function() { 
      FB.init({ 
      appId  : 'xxxxxxxxxxx', 
      cookie  : true, // enable cookies to allow the server to access 
           // the session 
      xfbml  : true, // parse social plugins on this page 
      version : 'v2.4' // use version 2.4 
      }); 

      // Now that we've initialized the JavaScript SDK, we call 
      // FB.getLoginStatus(). This function gets the state of the 
      // person visiting this page and can return one of three states to 
      // the callback you provide. They can be: 
      // 
      // 1. Logged into your app ('connected') 
      // 2. Logged into Facebook, but not your app ('not_authorized') 
      // 3. Not logged into Facebook and can't tell if they are logged into 
      // your app or not. 
      // 
      // These three cases are handled in the callback function. 

      FB.getLoginStatus(function(response) { 
      statusChangeCallback(response); 
      }); 

     }; 

     // Load the SDK asynchronously 
     (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')); 

    /***end FB***/ 
</script> 

EDIT

これは私がFacebookのドキュメントで見つけることができる唯一の参照です:

function myFacebookLogin() { 
    FB.login(function(){}, {scope: 'publish_actions'}); 
} 

FB.login(function(){ 
    // Note: The call will only work if you accept the permission request 
    FB.api('/me/feed', 'post', {message: 'Hello, world!'}); 
}, {scope: 'publish_actions'}); 

ログインコールで私は許可を必要とするので、承認されたアプリケーションに公開許可ダイアログが表示されないのはなぜですか?

EDIT

enter image description here

これは私のアプリの許可

+0

公開権限は、ログインダイアログの_second_ "ページ"にのみ表示されることにご注意ください。 – CBroe

+0

ログインダイアログの2番目の「ページ」が表示されません。私はスコープを分割するように提案されているので、私はログイン時に電子メールスコープだけを要求し、FB.apiではpublish_actionsスコープだけを要求しようとしましたが、何でも変わります。 – user31929

+0

FB.apiにスコープを渡すのは全くナンセンスです。初心者がいつもそんなに出てくるところを知りません... – CBroe

答えて

0

Publish_actionsスコープの画面では正しく動作するようになりましたように思われます。私は2回スコープリクエストを受けました。

関連する問題