Logging out from facebook using facebook c# sdk in WP7

此生再无相见时 提交于 2019-12-01 13:15:50

Use FacebookClient.Logout to generate the logout url.

This is the snippet from winforms sample which will work in wp7 with some modifications.

    private void btnLogout_Click(object sender, EventArgs e)
    {
        var fb = new FacebookClient();

        var logoutUrl = fb.GetLogoutUrl(new
                                            {
                                                next = "https://www.facebook.com/connect/login_success.html",
                                                access_token = _accessToken
                                            });
        var webBrowser = new WebBrowser();
        webBrowser.Navigated += (o, args) =>
                                    {
                                        if (args.Url.AbsoluteUri == "https://www.facebook.com/connect/login_success.html")
                                            Close();
                                    };

        webBrowser.Navigate(logoutUrl.AbsoluteUri);
    }

Make sure to persist the access token somewhere when you login as it is required to logout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!