# AspNetCore.Authentication issue with login path and redirect\_uri

**URL:** <https://community.auth0.com/t/aspnetcore-authentication-issue-with-login-path-and-redirect-uri/125903>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [January 29, 2024, 3:42am UTC](https://community.auth0.com/t/aspnetcore-authentication-issue-with-login-path-and-redirect-uri/125903 "2024-01-29T03:42:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![james.heliker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.heliker/32/54346_2.png) [@james.heliker](https://community.auth0.com/u/james.heliker)\
**Post date:** [January 29, 2024, 3:42am UTC](https://community.auth0.com/t/aspnetcore-authentication-issue-with-login-path-and-redirect-uri/125903/1 "2024-01-29T03:42:23Z")

</div>

Hello -

I’m working with Auth0.AspNetCore.Authentication in a Blazor Server app.

I noticed that I was forced to use /Account/Login and /Account/Logout as the paths were not exposed in the Auth0WebAppAuthenticationBuilder options.

I found a way to override this, with this code, which is fine, but it seems the redirect\_uri doesn’t work

```auto
builder.Services.Configure<CookieAuthenticationOptions>(CookieAuthenticationDefaults.AuthenticationScheme, options => {
    options.LoginPath = new PathString("/login");
    options.LogoutPath = new PathString("/logout");
});

```

Then I struggled to get redirect URI to work at all, until I modified the app.MapGet for /login as follows. Please tell me if I’m doing something wrong here? The code works, but it doesn’t line up with your tutorial for Blazor Server apps:

```auto
app.MapGet("/login", async (HttpContext httpContext, string redirectUri = "/") =>
    {
        var authenticationProperties = new LoginAuthenticationPropertiesBuilder()
                .WithRedirectUri(redirectUri)
                .Build();

        if (authenticationProperties.RedirectUri == "/" && httpContext.Request.Query.ContainsKey("ReturnUrl"))
        {
            authenticationProperties.RedirectUri = httpContext.Request.Query["ReturnUrl"];
        }

        await httpContext.ChallengeAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);
    });

```

---

<div class="post-metadata">

**Author:** ![markus.dresch](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@markus.dresch](https://community.auth0.com/u/markus.dresch)\
**Post date:** [July 2, 2024, 8:45am UTC](https://community.auth0.com/t/aspnetcore-authentication-issue-with-login-path-and-redirect-uri/125903/2 "2024-07-02T08:45:33Z")

</div>

i have the same problem with aspnet: [Dotnet: RedirectUri is ignored?](https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909)

redirect\_uri is simply ignored 🫤

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [May 12, 2025, 8:00pm UTC](https://community.auth0.com/t/aspnetcore-authentication-issue-with-login-path-and-redirect-uri/125903/3 "2025-05-12T20:00:30Z")

</div>

Hi @james.heliker,

Welcome to the Auth0 Community!

@markus.dresch has already solved this issue in his post:

> [@Dotnet: RedirectUri is ignored?](https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909/2):
>
> seems like this does the job: // .WithRedirectUri(redirectUri!) .WithParameter("redirect\_uri", redirectUri!)

If you have any other questions, feel free to reach out.

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 26, 2025, 8:01pm UTC](https://community.auth0.com/t/aspnetcore-authentication-issue-with-login-path-and-redirect-uri/125903/4 "2025-05-26T20:01:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
