<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y000061I3UhSAKOkta Classic EngineOkta Integration NetworkAnswered2024-04-16T13:11:02.000Z2019-03-05T14:52:22.000Z2019-05-13T19:57:47.000Z

u2ce9 (u2ce9) asked a question.

Okta Integration with Asp.net Core (Kestrel) and IIS

I'm using Asp.net core 2.1 with the full framework. I'm also using Okta.AspnetCore Nuget package 1.1.0. I have setup Okta and it works great in my debugger.

 

However when I move to IIS 7.5 it gives me an error. I'm guessing that has something to do with kestrel and IIS together but I'm not 100% sure how to fix it.

 

Error:

 

2019-02-28 15:14:37,260 [10] ERROR Microsoft.AspNetCore.Server.Kestrel [(null)] - Connection id "0HLKTN5E8L8QB", Request id "0HLKTN5E8L8QB:00000001": An unhandled exception was thrown by the application.

System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found.

 

This is my setup for Okta in my startup.cs

 

        services.AddAuthentication(options =>

        {

          options.DefaultAuthenticateScheme = OktaDefaults.ApiAuthenticationScheme;

          options.DefaultChallengeScheme = OktaDefaults.ApiAuthenticationScheme;

          options.DefaultSignInScheme = OktaDefaults.ApiAuthenticationScheme;

        })

        .AddOktaWebApi(new OktaWebApiOptions()

        {

          ClientId = "xxxxxx" // from config file

          OktaDomain = "xxxx.okta.com" // from config file

        });

 

I'm curious how to setup IIS and kestrel together with Okta.

 

 

 


  • Hi Thomas,

     

    This issue is usually related to IIS pointing out to IISDefaults class and skipping the details provided in Authorize decoration. To successfully migrate the code, you would require a small rewrite on [Authorize] decoration.

     

    Dragos Gaftoneanu

    Developer Support Engineer

    Okta Global Customer Care

    Expand Post
    Selected as Best
  • Hi Thomas,

     

    This issue is usually related to IIS pointing out to IISDefaults class and skipping the details provided in Authorize decoration. To successfully migrate the code, you would require a small rewrite on [Authorize] decoration.

     

    Dragos Gaftoneanu

    Developer Support Engineer

    Okta Global Customer Care

    Expand Post
    Selected as Best
This question is closed.
Loading
Okta Integration with Asp.net Core (Kestrel) and IIS