0

フィード ダイアログを表示せずにユーザーのウォールに投稿するために Facebook フィードを使用しています。ログインしているユーザーのウォールに投稿します。ただし、ユーザーがアプリを承認していない場合、ウォールに投稿していない場合、ユーザーがアプリを認証していない場合に認証を求めるダイアログを表示したい場合は、FB.getLoginStatus() を使用していますが、接続ステータスを返します。ドキュメントから私が読んだFB.getLoginStatusは、次の場合に接続を返します。こちらを参照してください

the user is logged into Facebook and has authenticated your application

これが私が FB.getLoginStatus() を使用している方法です

 FB.getLoginStatus(function (response) {
                        if (response.status === 'connected') {
                            alert("connt");
                            // the user is logged in and has authenticated your
                            // app, and response.authResponse supplies
                            // the user's ID, a valid access token, a signed
                            // request, and the time the access token 
                            // and signed request each expire
                            var uid = response.authResponse.userID;
                            var accessToken = response.authResponse.accessToken;
                        } else if (response.status === 'not_authorized') {
                            alert("not");
                            // the user is logged in to Facebook, 
                            // but has not authenticated your app
                        } else {
                            alert("aa");
                            // the user isn't logged in to Facebook.
                        }
                    });

これはウォール投稿用の私のコードです

 FB.api('/me/feed', 'post', { link: mywebsitelink, picture: mypicture, message: message }, function (response) {
                        if (!response || response.error) {
                            alert(response.error.message);
                        } else {
                            //  alert('Post ID: ' + response.id);
                        }
                    });

エラーメッセージが表示され、FB.getLoginStatus が接続済みと表示されます。

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

1 に答える 1

1

ウォールに投稿する前に、ユーザーは拡張アクセス許可 () を受け入れる必要があります。ユーザーがアプリを受け入れるときは、スコープに「publish_stream」権限を含めることを忘れないでください。

FB.login(function(response) {
// do you thing
}, {scope: 'publish_stream'});

FB.getLoginStatus() は、アプリが承認されたかどうかのみを通知し、拡張権限のいずれかが承認されたかどうかは通知しません。

于 2013-09-14T10:24:31.297 に答える