在我的一個應用程序中,我使用客戶端Facebook javascript api來跟蹤用戶的Facebook登錄狀態。FB.getSession()返回null
我已經有用戶已經與facebook應用程序連接,並且用戶登錄到了facebook。
現在,當我打電話FB.getSession()返回null,在調用FB.getLoginStatus()也沒有給我response.session ....
此行爲是在不同的瀏覽器不同,它的工作原理罰款鉻,但不是在Firefox 4.我在Firefox中清除cookie仍然沒有按預期工作。
這是客戶端api信任還是我應該選擇服務器端API?
代碼:
window.fbAsyncInit = function() {
FB.init({
appId: '0000000000',
status: true,
cookie: true,
xfbml: true
});
FB.getLoginStatus(function(response) {
if (response.session) {
// This block should have been called.
alert('logged in')
} else {
// no user session available, someone you dont know
alert('not logged in')
}
}, true);
var session = FB.getSession(); //Must not return null...
};
任何想法?
如何與我們分享一些代碼? – ifaour 2011-04-30 20:33:27