2011-01-28 67 views

回答

1

這是FacebookMobile,Facebook和FacebookDesktop不斷修訂的問題。基本上,你需要確保你設置了FacebookDesktop.manageSession = false;並傳入「註銷」您的網站的API網址的第二個參數。 If that doesn't work, the other method is to use "reallyLogout", as detailed here in this thread

評論#24中的註釋詳細介紹瞭如何從FacebooMobile(或您使用的任何單身人士)公開訪問令牌的方式,然後使用訪問令牌在Facebook上手動調用logout.php方法。

http://code.google.com/p/facebook-actionscript-api/issues/detail?id=297#c24

0

這是cookies的問題,我的意思是,firts用戶會話保持不變,當您按下登錄第一個用戶的API日誌時。

我不知道爲什麼,但Facebook的API註銷方法不會忘記用戶出的臉書只有登錄用戶出你的應用程序。

如果您找到了解決方案或想其他方法,請告訴我們,以便我們獲得解決方案。

2

我已經看到了網絡上的解決方案的無確實爲我工作。問題確實是StageWebView facebook cookie在使用FacebookMobile.logout()調用註銷時未被清除。使用訪問令牌加載logout.php並沒有幫助我,可能是因爲沒有適用於空中應用程序的「下一個」參數值。我看到有人建議在那裏使用localhost或facebook.com,但這些選項都不起作用。

我想出了一個非常可疑的解決方案,但它現在可行。 重點是通常在Facebook上註銷用戶,就像他自己註銷一樣。爲此,我們需要在StageWebView中加載facebook.com並單擊註銷。註銷按鈕是「logout_form」html表單的提交表單項。所以我們需要在我們的StageWebView中調用一個javaScript調用

document.getElementById('logout_form').submit(); 

。我們可以通過在ActionScript中調用

webView.loadURL("javascript:document.getElementById('logout_form').submit();"); 

,我使用的,現在

protected var _logoutAttemptInProgress:Boolean = false; 
public function fbLogout():void{ 
if(!_isLoggedIn) return; 
if(_logoutAttemptInProgress) return; 
_logoutAttemptInProgress = true; 

var webView:StageWebView = new StageWebView(); 
webView.viewPort = new Rectangle(-1, 0, 1, 1);   
webView.stage = this.stage;   
webView.loadURL("http://www.facebook.com/lksmlrsgnlskn"); 
webView.addEventListener(Event.COMPLETE, runLogoutJs); 

function runLogoutJs(event:Event):void{ 
    webView.removeEventListener(Event.COMPLETE, runLogoutJs); 
    var jsString:String = "document.getElementById('logout_form').submit();"; 
    webView.loadURL("javascript:"+jsString); 
    webView.addEventListener(Event.COMPLETE, closeWebView); 
} 

function closeWebView(event:Event):void{ 
    webView.removeEventListener(Event.COMPLETE, closeWebView); 
    webView.stage = null; 
    webView.dispose(); 

    _isLoggedIn = false; 
    _logoutAttemptInProgress = false; 
} 

FacebookDesktop.logout(null, APP_ORIGIN); 
} 

「lksmlrsgnlskn」完整的代碼只是一些隨機的垃圾得到錯誤比主頁,加載速度更快更小的頁面。

FacebookDesktop.logout將清除Facebook lib可能仍有的任何本地SharedObject數據。

+0

這個技巧很有效。期。感謝分享。 – benya 2014-06-04 20:04:41