Facebook js api 有 FB.getLoginStatus 方法。此方法返回用户登录状态,并告知用户是否未授权。可能这会有所帮助。
window.fbAsyncInit = function() {
FB.init({
'appId': "APPID",
'status': true,
'cookie': true,
'xfbml': true,
'oauth': true
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
} else if (response.status === 'not_authorized') {
// The user has not authorized your app so far
// do your stuff here (registration)
} else {
}
});
};