-1

ここに私の接続があります:

window.fbAsyncInit = function () {
    FB.init({
        appId: "348044465251207",
        status: true,
        cookie: true,
        xfbml: true,
        oauth: true
    });
    FB.Event.subscribe('auth.login', function (response) {
    var credentials = { uid: response.authResponse.userID, accessToken: response.authResponse.accessToken };
        SubmitLogin(credentials);
    }, { perms: 'read_stream,publish_stream,offline_access' });




    FB.getLoginStatus(function (response) {
        if (response.status === 'connected') {
            FB.api('/me', function (response) {
                //console.log('Good to see you, ' + response.name + '.');

                mail = response.email;
                currentName = response.name;
                gender = response.gender;
                place = response.location;

                $.ajax({
                    url: "/Login/DetailsToDataBase",
                    type: "POST",
                    data: { gender: gender, mail: mail, place: place },

                    success: function (data) {
                        generalScore = data;
                        div_element = document.getElementById("userScore");
                        div_element.innerHTML = "Your score is: " + generalScore;
                    }

                });

            });
        } //end if
        else if (response.status === 'not_authorized') { alert("user is not authorised"); }
        else { alert("user is not conntected to facebook"); }

    }, { scope: 'read_stream,publish_stream,offline_access' });

    function SubmitLogin(credentials) {
        $.ajax({
            url: "/Login/FacebookLogin",
            type: "POST",
            data: credentials,
            error: function () {
                alert("error logging in to your facebook account.");
            },
            success: function () {
              //  alert("success log in facebook");
                //     window.location.reload();
            }
        });
    }

};

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

これは、ユーザーの Facebook ウォールに投稿する関数です。

var params = {};
params['method'] = 'stream.publish';
params['message'] = currentName +' earn '+ score+ '$ in battelship!';
params['name'] = 'BattelShip';
params['description'] = 'let\'s see if you sucsses to break my highlight';
params['link'] = 'https://apps.facebook.com/348044465251207/?fb_source=search&ref=ts&fref=ts';
params['picture'] = 'http://www.israup.net/images/98d0808995e356818a0c016bc1a2a7cc.png';
params['caption'] = 'Try it by Yourself!';

FB.api('/me/feed', 'post', params, function(response) {
  if (!response || response.error) {
    console.log('Error occured');
  } else {
    console.log('Published to stream - you might want to delete it now!');
  }

});

それは私のウォールにのみ投稿します(私はアプリの管理者であるため)が、別のユーザーには次のように表示されます:「ユーザーはアプリケーションがこのアクションを実行することを許可していません」

お願い助けて!!

4

1 に答える 1

1

ログインのドキュメントをもう一度確認する必要があります。ログイン フローの一部である「perms」パラメータを使用していますが、これは 1 年以上前に廃止され、「scope」が優先されました。

SDKに付属の例を確認し、ログインドキュメントを読んでください。コードはそのエラーを修正すればうまくいくかもしれませんが、あなたが作業している例が書かれて以来、APIで他に何が変わったのか気になります. - アクセス トークンを指定して /me/permissions を呼び出すと、使用しているアクセス トークンに付与されたアクセス許可を確認できます。

于 2012-11-26T22:33:25.497 に答える