I have a Back-End using HangFire, whenever I try to connect to the dashboard, I get a 401 error.
program.cs:
builder.Services.AddAppHangfire();
builder.Services.AddAppAuthentication();
app.UseAppAuthentication();
app.UseAuthorization();
app.UseAppHangfire(app.Environment);
StartupHangfire.cs
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{
Authorization = new[]
{
new HangFireAuthorizationFilter()
}
});
public class HangFireAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize([NotNull] DashboardContext context)
{
var httpCtx = context.GetHttpContext();
return httpCtx.User.Identity.IsAuthenticated; //is always false
}
}
even though the user is signed in and has a valid token (tested through swagger)
using hangfire version 1.8
Does anyone know what the issue could be?