Пример #1
0
        protected void GoogleLoginBtn_Click(object sender, EventArgs e)
        {
            var google = new OAuth2Google(
                "13833862291-comaorjrjsp4vl85am44qkt3b7vqlip2.apps.googleusercontent.com",
                "wnWzkiapl7aLY7bKMiRjTend",
                "http://localhost:6625/auth/google/default.aspx");

            Response.Redirect(google.GetAuthorizationUrl("/"));
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OAuth2Google.Callback(
                Request.Params["code"],
                Request.Params["error"],
                Request.Params["state"],
                Request.Params["error_description"],
                Request.Params["error_uri"],
                success: state =>
            {
                OAuth2Google.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));
        }
Пример #3
0
        protected void GoogleLoginBtn_Click(object sender, EventArgs e)
        {
            var google = new OAuth2Google(
                "13833862291-comaorjrjsp4vl85am44qkt3b7vqlip2.apps.googleusercontent.com",
                "wnWzkiapl7aLY7bKMiRjTend",
                "http://localhost:6625/auth/google/default.aspx",
                success: api =>
            {
                LoginUser(
                    "Google-" + 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(google.GetAuthorizationUrl("/"));
        }