fix(auth): configure Identity cookie paths to use custom login page

Add ConfigureApplicationCookie to override Identity default paths
(/Account/Login) with custom paths (/login). This fixes the 404 error
when unauthenticated users are redirected to the login page.
This commit is contained in:
Arnaud Dartois committed 2026-07-24 17:55:23 +00:00
1 parent 364e8e6f55
commit e5fb13632f
1 file changed
+8
@@ -55,6 +55,14 @@ public static class DependencyInjection
.AddEntityFrameworkStores<AppDbContext>()
.AddDefaultTokenProviders();
// Configure Identity cookie paths to use custom login page instead of default /Account/Login
services.ConfigureApplicationCookie(options =>
{
options.LoginPath = "/login";
options.LogoutPath = "/_auth/signout";
options.AccessDeniedPath = "/not-found";
});
// Data Protection (for camera credential encryption)
var dpMode = configuration.GetValue<string>("DataProtection:Mode") ?? "Persisted";
if (dpMode == "Ephemeral")