Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangfire UI - redirect_uri is http instead of https #2402

Open
w-johnny opened this issue May 14, 2024 · 0 comments
Open

Hangfire UI - redirect_uri is http instead of https #2402

w-johnny opened this issue May 14, 2024 · 0 comments

Comments

@w-johnny
Copy link

Hi,
I would like to enable HF UI in my application.

I am using auth0. The problem is when I try to log in in auth0 I am redirected to such a page:

Callback URL mismatch.
The provided redirect_uri is not in the list of allowed callback URLs.
Please go to the [Application Settings page] and make sure you are sending a valid callback url from your application.

This is aligned with auth0 configuration I have and this is expected behavior because the redirect_uri is http instead of https:

&redirect_uri=http%3A%2F%2Fapi-

I allow only https urls.

Here is my configuration:

public class Startup
{
    //...

    public void Configure(IApplicationBuilder app, IHostEnvironment env)
    {
        //...
        app.UseHttpsRedirection();
        //...
        app.UseEndpoints(endpoints =>
        {
            //...

            AddHangfireDashboardIfConfigured(app, endpoints);
        });
    }
    
    private void AddHangfireDashboardIfConfigured(IApplicationBuilder app, IEndpointRouteBuilder endpoints)
    {
        var configuration = app.ApplicationServices.GetService<IGlobalConfiguration>();
        if (configuration != null)
        {
            endpoints.MapHangfireDashboard(HangfireAuthenticationOptions.HangfireDashboardUrl, new DashboardOptions
            {
                IsReadOnlyFunc = _ =>
                {
                    var authenticationOptions = _configuration
                        .GetSection(HangfireAuthenticationOptions.Authentication)
                        .Get<HangfireAuthenticationOptions>() ?? new HangfireAuthenticationOptions();

                    return authenticationOptions.IsReadonly;
                },
            }).RequireAuthorization(ApplicationAuthorizationServiceCollectionExtensions.HangfireAuthorizationPolicyName);
        }
    }
}

Is there any way to force Hangfire UI to use https instead of http?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant