フィード ダイアログを表示せずにユーザーのウォールに投稿するために 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