I have a AspNetCore web project targeting the full .NET 461 framework.
net461
In my StartUp.cs I have the following in the ConfigureSercices:
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie()
.AddOktaMvc(new OktaMvcOptions()
{
ClientId = “…”,
ClientSecret = “…”,
OktaDomain = “…”,
});
In my AccountController I have the following method to log users in:
public ActionResult Login()
{
if (!HttpContext.User.Identity.IsAuthenticated)
{
return Challenge(OktaDefaults.MvcAuthenticationScheme);
}
return RedirectToAction("Index", "Home");
}
The when the user logs in the Challenge is throw and I see the following calls to otka being made:
https://XXXXXXXX.okta.com/oauth2/default/.well-known/openid-configuration
https://XXXXXXXX.okta.com/oauth2/default/v1/keys
https://dev-491853.okta.com/oauth2/default/v1/authorize?client_id=0oaj7hkecDdvwyn9X356&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fauthorization-code%2Fcallback&response_type=code&scope=openid%20profile&response_mode=form_post&nonce=636925056729129867.OTM4NjRlYTYtYTgyYS00OTM1LWFjMmItZGQwM2RlNGY5MmMzZjg4NWU4YTUtYWM0NS00Y2ExLTkzMWItODMzZDljOTY1YjZk&state=CfDJ8H3AdBfEUL9Nm7WPgcJGi-M17W5Pb1XRKtysLeSISfGnC1RAf2Dw0rTnww4ZSQ6SYGN-VW0c_75Y17RPL0KuUTUicvkJKrQ62jbxDShEQHughVjyQ6QSKWjReLsaw2P35GQTmMtr_eP9F-FseeL937-SLd28MSwxIzXiRA27lSUonwnfZFLVIGcPnfqFfIcqEl48Vq1GhAS8IuPhA7Lj_WkBHEfXjTVe8ByXHsB3lz9uuu1pliYbv8fwbZ14FcC28-WNn8Zfr1HB7dydmvJutDAcFiLIySs9wnWDp7yy0Zs2s9ae8wigPBwoVO-8yt_70wqQ-pVKfbeErzkDyJnTO0fdo0k2eu5GIYmaSYHRSADZghz4dic4GxlJy_kLB93nQT7gdWiIZc4HgEMdCpcxVjCuUvWzv0JWfCneSxJpL2PS&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0
At this point the default application page is shown (no auth needed) instead of the okta login page. Then I test the url redirect : http://localhost:8080/authorization-code/callback I get a 404 Page not found. Is this being caused by not targeting the netcoreapp2.0 framework?