I have developed a web application using dot net core 1.1. It was working fine till I've updated to asp core 2.0. Then when trying to use the application, it reports this error:
InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found.
The authentication config of JwtBearerAuthentication, in the Configure
method of Startup.cs
was previously like bellow:
app.UseJwtBearerAuthentication(new JwtBearerOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
TokenValidationParameters = tokenValidationParameters
});
After facing this error I have updated that to this one:
app.UseJwtBearerAuthentication(new JwtBearerOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
TokenValidationParameters = tokenValidationParameters,
AuthenticationScheme = JwtBearerDefaults.AuthenticationScheme
});
But still the error message is alive. Am I looking wrong place for the error or I have have to add additional configurations for the authentication system to work?
I've just followed this article and everything goes perfect.
Migrating Authentication and Identity to ASP.NET Core 2.0
Hope it helps other.
TG.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With