2013-02-21 100 views
0

我正在为用户需要登录的Windows Phone 8开发应用程序,然后该应用程序将张贴到用户的墙上。为什么我下次使用我的应用程序时不需要登录?

我已经基本弄清楚了,但在第一次登录后,我不必再次登录。我尝试删除手机上的浏览器数据,检查了我的运行时目录,并尝试使用FacebookClient.GetLogoutUrl注销并导航到它,但仍认为我已登录。

我的登录信息如何存储?

一旦我弄清楚了,是否有一种很好的方法可以在运行时确定这一点,以便我的应用程序可以相应地进行自我配置?

回答

0

您必须提供GetLogoutURL功能与用户access_token

试试这个方法得到LogoutURL并导航到它:

public static string GetLogoutURL(string AccessToken) 
{ 
    var fb = new FacebookClient(); 
    var logoutUrl = fb.GetLogoutUrl(new { access_token = AccessToken, next = "https://www.facebook.com/connect/login_success.html" }); 
    return logoutUrl.ToString(); 
} 

使用任何隐藏的web浏览器做这个导航:

AnyWebBrowserControl.Navigate(GetLogoutURL(AccessToken)); 
0

这是因为一旦产生,一个访问令牌有效期为2个月。即使用户注销,仍然可以向API发出请求,直到访问令牌有效。

And once I figure that out, is there a good way to determine this at runtime so that my app can configure itself accordingly?

是的,你可以检查(在运行时),如果访问令牌是有效的或过期通过寻找FacebookOAuthException

这里有一个很好的教程:http://www.thepcwizard.in/2013/02/working-with-facebook-c--sharp-sdk.html

相关问题