Exemple #1
0
        protected void LinkedInLoginBtn_Click(object sender, EventArgs e)
        {
            var linkedIn = new OAuth2LinkedIn(
                "86lgvuhdop1tce",
                "KVVScEdl1fbpTVyW",
                "http://localhost:6625/auth/linkedin/default.aspx");

            Response.Redirect(linkedIn.GetAuthorizationUrl("/"));
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OAuth2LinkedIn.Callback(
                Request.Params["code"],
                Request.Params["error"],
                Request.Params["state"],
                Request.Params["error_description"],
                Request.Params["error_uri"],
                success: state =>
            {
                OAuth2LinkedIn.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));
        }
Exemple #3
0
        protected void LinkedInLoginBtn_Click(object sender, EventArgs e)
        {
            var linkedIn = new OAuth2LinkedIn(
                "86lgvuhdop1tce",
                "KVVScEdl1fbpTVyW",
                "http://localhost:6625/auth/linkedin/default.aspx",
                success: api =>
            {
                LoginUser(
                    "LinkedIn-" + 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(linkedIn.GetAuthorizationUrl("/"));
        }