简体   繁体   中英

not able to logout from facebook using facebook c# sdk

I am Using facebook C# SDK to connect to facebook from my mvc3 application. I am able to login but not able to logout. I used bellow code for logout

var oauth = new FacebookClient();

        var logoutParameters = new Dictionary<string, object>
              {
                  { "next", "http://localhost:8691" }
              };

        var logoutUrl = oauth.GetLogoutUrl(logoutParameters);

        return Redirect(logoutUrl.ToString());

This code always redirects me to facebook home page.

查看此链接 ,他们建议使用FB的javascript sdk处理所有登录\\注销。

I have solved it. I just passed access token in logoutParameters.

Here is my action result code.

        public ActionResult LogOut(string accessToken)
    {
        var oauth = new FacebookClient();

        var logoutParameters = new Dictionary<string, object>
              {
                 {"access_token", accessToken},
                  { "next", "http://localhost:8691" }
              };

        var logoutUrl = oauth.GetLogoutUrl(logoutParameters);

        return Redirect(logoutUrl.ToString());
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM