# Infinite loop in the sign in page

**URL:** <https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207>\
**Category:** Questions\
**Tags:** dotnet\
**Created:** [February 8, 2018, 7:25pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207 "2018-02-08T19:25:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![leoliao](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leoliao](https://devforum.okta.com/u/leoliao)\
**Post date:** [February 8, 2018, 7:25pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/1 "2018-02-08T19:25:58Z")

</div>

The issue is when it is logining in, the sign in page keeps refreshing and calling okta. It looks like the app is in an infinite loop. The attachment shows tjhe issue. Could anyone please solve this issue for me? it is kind of urgent.

My web app is .net core 2 web app.

This part is my configuration in Configuration services:

```auto
services.AddAuthentication(sharedOptions =>
            {
                sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            })
            .AddCookie(options=> { options.Cookie.SameSite = SameSiteMode.Lax; })
            .AddOpenIdConnect(options =>
            {
                // Configuration pulled from appsettings.json by default:
                options.ClientId = Configuration["okta:ClientId"];
                options.ClientSecret = Configuration["okta:ClientSecret"];
                options.Authority = Configuration["okta:Authority"];
                options.CallbackPath = "/Account/Login";
                //options.ResponseType = "code";
                options.SaveTokens = true;
                options.UseTokenLifetime = false;
                options.GetClaimsFromUserInfoEndpoint = true;
                options.Scope.Add("openid");
                options.Scope.Add("profile");
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    NameClaimType = "name"
                };
            });

```

Login action:

```auto
 public IActionResult Login()
        {
            if (!HttpContext.User.Identity.IsAuthenticated)
            {

                return Challenge(OpenIdConnectDefaults.AuthenticationScheme);
            }
            return RedirectToAction("Index", "Home");
          
        }

```

Configure method in startup:

```auto
app.UseSession();
            loggerFactory.AddConsole(this.Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseAuthentication();
            app.Use(async (context, next) =>
            {
                if (string.Equals(context.Request.Host.Host.ToString(), "localhost", StringComparison.InvariantCultureIgnoreCase))
                {
                    await next.Invoke();
                }
                else
                {
                    context.Request.Scheme = "https";
                    await next.Invoke();
                }
            });

            //app.UseForwardedHeaders(new ForwardedHeadersOptions
            //{
            // ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            //});
            app.UseStaticFiles();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "ItemPerformance/{controller=Account}/{action=Login}/{id?}");
                routes.MapRoute(
                    name: "default1",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

```

 ![sign_in_page](https://global.discourse-cdn.com/oktadev/original/1X/8aefdcb27110faa73c5aafabb60cfccaf43eebc7.jpg)

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [February 8, 2018, 7:41pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/2 "2018-02-08T19:41:42Z")

</div>

If this is urgent - please reach out to [developers@okta.com](mailto:developers@okta.com) they can give your actual SLA, the dev forum does not have an SLA on response times.

@lee.brandt or @nate.barbettini have any thoughts here?

---

<div class="post-metadata">

**Author:** ![leoliao](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leoliao](https://devforum.okta.com/u/leoliao)\
**Post date:** [February 8, 2018, 7:49pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/3 "2018-02-08T19:49:26Z")

</div>

I am not quite sure if I configure OKTA in a wrong way? Probably it is because my code?

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [February 8, 2018, 7:56pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/4 "2018-02-08T19:56:34Z")

</div>

I’m a total newb with .NET so I’m not the right person to help.

If you catch the call to the authorize route and the redirect callback, what do they look like from the browser?

The redirect callback may be in error that is causing your code to redirect back to login?

Just trying to help you troubleshoot.

---

<div class="post-metadata">

**Author:** ![leoliao](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leoliao](https://devforum.okta.com/u/leoliao)\
**Post date:** [February 8, 2018, 9:44pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/6 "2018-02-08T21:44:32Z")

</div>

The problem is solved.😂

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [February 8, 2018, 9:48pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/7 "2018-02-08T21:48:41Z")

</div>

Thanks for the update - what was the issue? Just in case someone else runs into the same problem.

---

<div class="post-metadata">

**Author:** ![leoliao](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leoliao](https://devforum.okta.com/u/leoliao)\
**Post date:** [February 8, 2018, 10:01pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/8 "2018-02-08T22:01:43Z")

</div>

Actually, it is not the problem of OKTA. it is just the url issue. Our app is running in aws docker. So after authentication, the method could not find the correct url to redirect which causes infinite loop. URL is always annoying thing to deal with for web app. 😂😅

---

<div class="post-metadata">

**Author:** ![shameem](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@shameem](https://devforum.okta.com/u/shameem)\
**Post date:** [March 22, 2018, 10:45am UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/9 "2018-03-22T10:45:42Z")

</div>

hello, can someone help me with the looping issue. I integrated Victorops application with okta but users are not able to login as it is always showing a looping screen. I tried this in Okta sandbox but all was fine with it and users could login. One thing to mention here is that in Okta Sandbox, users were created manually and in production they are AD integrated.Can you please suggest…thank you!

---

<div class="post-metadata">

**Author:** ![sachin.badave](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@sachin.badave](https://devforum.okta.com/u/sachin.badave)\
**Post date:** [October 6, 2020, 5:15am UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/10 "2020-10-06T05:15:36Z")

</div>

Hi Leoliao, could you please post exactly what configuration you used in okta?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 25, 2024, 6:39pm UTC](https://devforum.okta.com/t/infinite-loop-in-the-sign-in-page/1207/11 "2024-01-25T18:39:31Z")

</div>

Closed on January 25, 2024, 6:39pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
