如果我有一个用户已经登录到 facebook 但从他/她的帐户中删除了我的应用程序,我如何才能在用户已经登录后再次输入我的应用程序时才提示发布流?
谢谢。
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' });
};
});
}