i am working with aspnet core WEB Api application.
While Login i am validating user through SignInManager like this.
await _signInManager.PasswordSignInAsync
Äfter that i am generating jwt token for that user.
i have added [Authorize] tag in controller method.
when i am sending request with out token or invalid token, i am getting 404 error instead of 401 error.
This is startup.cs file
var tp_options = new TokenProviderOptions
{
Audience = xyz,
Issuer = xyz,
SigningCredentials = new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256),
};
app.UseJwtBearerAuthentication(new JwtBearerOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
TokenValidationParameters = tokenValidationParameters,
AuthenticationScheme = JwtBearerDefaults.AuthenticationScheme,
});
app.UseStaticFiles();
app.UseFileServer();
app.UseIdentity();
i have added a app.UseIdentity();
. This is required for signInManger to validate login.
if i remove app.UseIdentity()
i am getting 401 error ,but signInManager is getting exception "No authentication handler is configured to handle the scheme: Identity.Application"
how can i achieve both functionality here. i want to use both JWT Token validation and ASP IDENTITY.