HangfireIO / HangfireIO/Hangfire

AsyncAuthorization causes issues with Dashboard UI

Open
#2,382 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

When I use AsyncAuthorization, it causes issues with the Dashboard UI.

Styles and scripts fails to load correctly, leading the graphics to disappear in the home page of the dashboard. In addition, trigger and delete buttons remain disabled when a recurring job is selected.

Here's my code:

```csharp
var userManager = app.Services.GetRequiredService().CreateScope()
.ServiceProvider.GetRequiredService>();

app.UseHangfireDashboard("/Hangfire", new DashboardOptions
{
DashboardTitle = "Dashboard",
DisplayStorageConnectionString = false,
AppPath = "/App",
AsyncAuthorization = new [] { new MyAsyncAuthorizationFilter(userManager) }
});
```

When I use Authorization instead of AsyncAuthorization as below, everything works fine.

```csharp
var userManager = app.Services.GetRequiredService().CreateScope()
.ServiceProvider.GetRequiredService>();

app.UseHangfireDashboard("/Hangfire", new DashboardOptions
{
DashboardTitle = "Dashboard",
DisplayStorageConnectionString = false,
AppPath = "/App",
Authorization = new [] { new MyAuthorizationFilter(userManager) }
});
```

I'm currently using ASP.NET 8.0.1 with Hangfire 1.8.11 Nuget package installed.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue through UseHangfireDashboard with DashboardOptions.AsyncAuthorization, then compare its behavior with DashboardOptions.Authorization. Trace how the dashboard serves styles, scripts, and recurring-job trigger/delete actions during asynchronous authorization. Done means the dashboard graphics load and the trigger and delete buttons are enabled when recurring jobs are selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.