
u2ce9 (u2ce9) asked a question.
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