2011-01-28 28 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