Skip to content

Commit

Permalink
Merge pull request #4 from auth0-blog/fix-returnurl
Browse files Browse the repository at this point in the history
Fix `returnUrl`
  • Loading branch information
andychiare authored Jul 3, 2024
2 parents cc243cd + 4a5fcdc commit 74a43af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion BlazorIntAuto/Components/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<a href="Account/Logout">Log out</a>
</Authorized>
<NotAuthorized>
<a href="Account/Login?redirectUri=/">Log in</a>
<a href="Account/Login">Log in</a>
</NotAuthorized>
</AuthorizeView>
8 changes: 4 additions & 4 deletions BlazorIntAuto/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
app.UseStaticFiles();
app.UseAntiforgery();

app.MapGet("/Account/Login", async (HttpContext httpContext, string redirectUri = "/") =>
app.MapGet("/Account/Login", async (HttpContext httpContext, string returnUrl = "/") =>
{
var authenticationProperties = new LoginAuthenticationPropertiesBuilder()
.WithRedirectUri(redirectUri)
.WithRedirectUri(returnUrl)
.Build();

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

app.MapGet("/Account/Logout", async (HttpContext httpContext, string redirectUri = "/") =>
app.MapGet("/Account/Logout", async (HttpContext httpContext) =>
{
var authenticationProperties = new LogoutAuthenticationPropertiesBuilder()
.WithRedirectUri(redirectUri)
.WithRedirectUri("/")
.Build();

await httpContext.SignOutAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);
Expand Down

0 comments on commit 74a43af

Please sign in to comment.