예제 #1
0
        //
        // GET: /Account/LogOff/

        public ActionResult LogOff()
        {
            FormsAuthentication.SignOut();
            var oAuthClient = new FacebookOAuthClient {
                RedirectUri = new Uri(LogoffUrl)
            };
            var logoutUrl = oAuthClient.GetLogoutUrl();

            return(Redirect(logoutUrl.AbsoluteUri));
        }
예제 #2
0
        public ActionResult LogOff()
        {
            if (FacebookWebContext.Current.IsAuthenticated())
            {
                FacebookWebContext.Current.DeleteAuthCookie();
                FacebookOAuthClient oauth = new FacebookOAuthClient(FacebookWebContext.Current.Settings);
                var logoutUrl             = oauth.GetLogoutUrl(new Dictionary <string, object> {
                    { "next", Request.UrlReferrer.AbsoluteUri.ToString() }
                });

                FormsService.SignOut();
                return(Redirect(logoutUrl.AbsoluteUri));
            }
            FormsService.SignOut();
            return(RedirectToAction("Login"));
        }
예제 #3
0
        private static string FaceBookLoggedOutUrl(string pToken)
        {
            var oauth = new FacebookOAuthClient
            {
                ClientId     = LGTHelperConfiguraton.FaceBookAppId,
                RedirectUri  = new Uri(UrlReturnLoginSocialNetwork),
                ClientSecret = LGTHelperConfiguraton.FaceBookAppSecret
            };
            var loginParameters = new Dictionary <string, object>
            {
                { "response_type", "code" },
                { "scope", FacebookScope },
                { "RedirectUri", UrlReturnLoginSocialNetwork },
                { "next", UrlReturnLoginSocialNetwork },
                { "access_token", pToken }
            };

            var url = oauth.GetLogoutUrl(loginParameters).ToString();

            //TODO utiliza o ambiente seguro para deslogar do facebook, é um bug no sdk usar a página m.
            url = url.Replace("http://m.", "https://www.");
            return(url);
        }