OKTA OpenId ASP.Net MVC app throwing 400

Hi,

I implemented OKTA OpenId in my existing ASP.NET MVC application as my client has moved to OKTA org. I used the example:

This app is now part of client’s OKTA Org from where users clicks the app tile and gets redirected to the home page of ASP.NET MVC application.

Now on clicking OKTA org tile, the app is going into a loop of sign in steps and after some time it throws error:

Bad Request - Request Too Long

HTTP Error 400. The size of the request headers is too long.

My startup file is has following code in Configuration method

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOktaMvc(new OktaMvcOptions()
        {
            OktaDomain = ConfigurationManager.AppSettings["okta:OktaDomain"],
            ClientId = ConfigurationManager.AppSettings["okta:ClientId"],
            ClientSecret = ConfigurationManager.AppSettings["okta:ClientSecret"],
            AuthorizationServerId = string.Empty,
            RedirectUri = ConfigurationManager.AppSettings["okta:RedirectUri"],
            PostLogoutRedirectUri = ConfigurationManager.AppSettings["okta:PostLogoutRedirectUri"],
            GetClaimsFromUserInfoEndpoint = true,
            Scope = new List<string> { "openid", "profile", "email" },
        });

Please help.

Hello Shipra, did you find a solution for this? We’re seeing the same thing but it’s not consistent.