javascript sdk を使用して接続ユーザーの Facebook ウォールに投稿しようとしています。これが私のコードです。
var connecter=false;
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxx', // App ID
oauth : true,
channelUrl : '//www.streamazing.net/js/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('auth.login', function (response) {
window.location.reload();
});
FB.Event.subscribe('auth.logout', function (response) {
window.location.reload();
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
connecter=true;
FB.api('/me', function(user) {
var user2=user;
console.log(user2.name);
});
}
else connecter=false;
});
var body = 'This is a test';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
console.log(response.error);
} else {
alert('Post ID: ' + response.id);
}
});
};
コンソールログは次のとおりです。
code: 2500
message: "An active access token must be used to query information about the current user."
type: "OAuthException"
私はこのコードで許可を求めています:
<fb:login-button autologoutlink='true' scope='email,user_birthday,status_update,publish_stream'></fb:login-button>
Facebook がアクセス トークンを要求する理由がわかりません。誰か助けてもらえますか? どうもありがとうございました。