remove this Microsoft.IdentityModel.Tokens then the jwt is worked

This commit is contained in:
Kham
2025-11-11 08:23:12 +11:00
parent 6344546157
commit e4f9104eea
5 changed files with 102 additions and 100 deletions
+17 -18
View File
@@ -103,12 +103,6 @@ namespace CarParkValidationAPI
app.UseDeveloperExceptionPage();
}
*/
app.UseMiddleware<ErrorHandlerMiddleware>(); // use this exception
app.UseSwagger();
app.UseSwaggerUI();
app.UseRouting();
// global cors policy
app.UseCors(x => x
@@ -118,22 +112,27 @@ namespace CarParkValidationAPI
.WithExposedHeaders("Content-Disposition")
.AllowCredentials());
// global error handler
//app.UseMiddleware<ErrorHandlerMiddleware>();
// custom jwt auth middleware
app.UseMiddleware<JwtMiddleware>();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
app.UseMiddleware<ErrorHandlerMiddleware>(); // use this exception
app.UseSwagger();
app.UseSwaggerUI();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseAuthentication();
app.UseAuthorization();
}
}