Skip to content

Duplicate GET /login endpoints cause AmbiguousMatchException locally #1155

Closed

Description

@StuartFerguson

The Blazor Server UI throws Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException when navigating to GET /login locally. The route is registered twice: Components/Pages/Login.razor declares @page /login, and EstateManagementUI.BlazorServer/Common/BoostrapperExtensions.cs maps GET /login inside ConfigureLiveLogin().\n\nImpact: the local live-auth application cannot reach the login page.\n\nProposed fix: keep /login owned by Login.razor and remove the conflicting live-mode MapGet registration. Preserve the OIDC challenge flow through a separate endpoint or page-triggered flow, and add a regression test proving only one GET /login endpoint is registered.

Activity

  1. StuartFerguson commented on Sep 15, 2026

    @StuartFerguson
    MemberAuthor

    Proposed code change details:

    1. In EstateManagementUI.BlazorServer/Common/BoostrapperExtensions.cs, remove the live-mode app.MapGet("/login", ...) registration that currently issues the OIDC challenge.
    2. Add a distinct live-auth endpoint, for example GET /authentication/login, that issues the same Results.Challenge(...) with the existing OpenID Connect scheme, RedirectUri = "/", and prompt = "login" properties.
    3. Update Components/Pages/Login.razor so /login remains the single Blazor route. In live mode, render or use a link to /authentication/login; in test modes, retain the existing /test-support/login form.
    4. Leave /logout unchanged.
    5. Add a regression test that builds the route table and verifies there is exactly one GET endpoint for /login, while the live challenge endpoint remains available separately.

    This keeps /login as the user-facing Blazor page, preserves the OIDC challenge flow, and prevents ASP.NET Core endpoint ambiguity.

  2. linked a pull request that will close this issueFix duplicate login route handling #1156on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions