Пример #1
0
        private void SetUrls()
        {
            if (!_googleAuthUrl.IsNullOrEmpty())
            {
                return;
            }

            var client    = _auth0Helper.CreateAuthenticationApiClientIfNotExists();
            var returnUrl = $"{WebUtils.GetApplicationUrlPath(HttpContext.Current)}{CurrentUser.LanguageCode}/account/login-register/";

            if (!ReturnUrl.IsNullOrEmpty())
            {
                returnUrl = $"{returnUrl}?returnUrl={ReturnUrl}";
            }

            var google_authorizationUrl = client.BuildAuthorizationUrl()
                                          .WithResponseType(AuthorizationResponseType.Code)
                                          .WithClient(Auth0Helper.Auth0ClientId)
                                          .WithConnection("google-oauth2")
                                          .WithRedirectUrl(returnUrl)
                                          .WithScope("openid profile email")
                                          .Build();

            _googleAuthUrl = google_authorizationUrl.ToString();

            var facebook_authorizationUrl = client.BuildAuthorizationUrl()
                                            .WithResponseType(AuthorizationResponseType.Code)
                                            .WithClient(Auth0Helper.Auth0ClientId)
                                            .WithConnection("facebook")
                                            .WithRedirectUrl(returnUrl)
                                            .WithScope("openid profile email")
                                            .Build();

            _facebookAuthUrl = facebook_authorizationUrl.ToString();

            //var twitter_authorizationUrl = client.BuildAuthorizationUrl()
            //    .WithResponseType(AuthorizationResponseType.Code)
            //    .WithClient(Auth0Helper.Auth0ClientId)
            //    .WithConnection("twitter")
            //    .WithRedirectUrl(returnUrl)
            //    .WithScope("openid profile email")
            //    .Build();
            //_twitterAuthUrl = twitter_authorizationUrl.ToString();

            var linkedIn_authorizationUrl = client.BuildAuthorizationUrl()
                                            .WithResponseType(AuthorizationResponseType.Code)
                                            .WithClient(Auth0Helper.Auth0ClientId)
                                            .WithConnection("linkedin")
                                            .WithRedirectUrl(returnUrl)
                                            .WithScope("openid profile email")
                                            .Build();

            _linkedInAuthUrl = linkedIn_authorizationUrl.ToString();
        }
Пример #2
0
 public AccountPageController()
 {
     _auth0Helper = new Auth0Helper();
     _client      = _auth0Helper.CreateAuthenticationApiClientIfNotExists();
 }