Example #1
0
        protected void FacebookLoginBtn_Click(object sender, EventArgs e)
        {
            var facebook = new OAuth2Facebook(
                "2825308727576238",
                "ec0ef89c230451f91a510e00f217c1a2",
                "http://localhost:6625/auth/facebook/default.aspx");

            Response.Redirect(facebook.GetAuthorizationUrl("/"));
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OAuth2Facebook.Callback(
                Request.Params["code"],
                Request.Params["error"],
                Request.Params["state"],
                Request.Params["error_description"],
                Request.Params["error_uri"],
                success: state =>
            {
                OAuth2Facebook.SuccessCallback(state);

                LoginHelper.LoginUser(
                    state.ProviderName + "-" + state.PersonId,
                    state.PersonName,
                    state.PersonEmail,
                    state.PersonPhotoUrl,
                    "User");

                HttpContext.Current.Response.Redirect(state.ReturnUrl);
            },
                failure: state => HttpContext.Current.Response.Redirect(state.ReturnUrl));
        }
Example #3
0
        protected void FacebookLoginBtn_Click(object sender, EventArgs e)
        {
            var facebook = new OAuth2Facebook(
                "2293070497624844",
                "c530b7a2614a93b328f0c170c6fcd001",
                "http://localhost:6625/auth/facebook/default.aspx",
                success: api =>
            {
                LoginUser(
                    "Facebook-" + api.PersonId,
                    api.PersonName,
                    api.PersonEmail,
                    api.PersonPhotoUrl,
                    "User");

                HttpContext.Current.Response.Redirect(api.ReturnUrl);
            },
                failure: api =>
            {
                HttpContext.Current.Response.Redirect(api.ReturnUrl);
            });

            Response.Redirect(facebook.GetAuthorizationUrl("/"));
        }