0

I am creating a single page application with angularJs, aspnet and thinktecture. I have created a login screen in thinktecture (as localhost:44304) for customer login and after successful login, it redirects to customer portal like https://localhost:44302.

when I run the customer app then it redirected to thinktecture login screen and after a login success, it come back to customer portal.

Now issue is that any customer can register a request by using registration page which is placed on the customer portal and we are redirecting it from thinktecture login screen as shown enter image description here

When I click on "here" link then redirect me again same login screen.

I added the code as below in startup.cs for customer poratal.

System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");

        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = "Cookies"
        });

        string thinkTectureUrl = ConfigurationManager.AppSettings["ThinkTectureUrl"].ToString();
        string loginSuccessUrl = ConfigurationManager.AppSettings["LoginSuccessUrl"].ToString();
        string clientSecret = ConfigurationManager.AppSettings["ClientSecret"].ToString();

        app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions()
        {
            ClientId = "Provista.CustomerPortal.WebApp.External",
            Authority = thinkTectureUrl,
            RedirectUri = loginSuccessUrl,
            ResponseType = "id_token",
            Scope = "openid email",
            SignInAsAuthenticationType = "Cookies",
            ClientSecret = clientSecret.Sha256()
        });

I searched on google and stackoverflow a lot but didn't get a reliable link that help me to solve this. Please reply as soon as possible if any one have any idea.

Ghost Answer
  • 1,458
  • 1
  • 17
  • 41

1 Answers1

0

You might have global authorization filter which redirects unauthenticated users to identity server. Probably in Global.asax

filters.Add(new System.Web.Mvc.AuthorizeAttribute()); 

Requests to your 'Register User controller' also treated by this filter and redirect to identity server will happen.

To override global filter and allow unauthenticated users to your Register User controller use [AllowAnonymous] attribute in your 'Register User controller'.

rawel
  • 2,923
  • 21
  • 33