既に Facebook にログインしているユーザーがアカウントからアプリを削除した場合、ユーザーが既にログインしているため、アプリに再度アクセスしたときにのみ、publish_stream を要求するにはどうすればよいですか?
ありがとう。
FB.getLoginStatus(function (response) {
if (response.status === 'connected') {
// 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
uid = response.authResponse.userID;
accesstoken = response.authResponse.accessToken;
SrReferral = '@ViewBag.Referral';
window.fbuserid = uid;
var postData = { facebookUID: uid, facebookAccessTok: accesstoken, facebookSrReferral: SrReferral };
$.ajax({
url: '@Url.Action("DisplayGolfers")',
type: 'POST',
data: postData,
dataType: 'html',
success: function (responseText) {
$("#container").html(responseText);
}
});
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
} else {
// the user isn't logged in to Facebook.
window.FB.login(function (response) {
if (response.authResponse) {
uid = response.authResponse.userID;
accesstoken = response.authResponse.accessToken;
SrReferral = '@ViewBag.Referral';
window.fbuserid = uid;
var postData = { facebookUID: uid, facebookAccessTok: accesstoken, facebookSrReferral: SrReferral };
$.ajax({
url: '@Url.Action("DisplayGolfers")',
type: 'POST',
data: postData,
dataType: 'html',
success: function (responseText) {
$("#container").html(responseText);
}
});
} else {
console.log('User cancelled login or did not fully authorize.');
alert('User cancelled login');
}
}, { scope: 'publish_stream' });
};
});
}