79271332

Date: 2024-12-11 10:31:04
Score: 0.5
Natty:
Report link

I found the issue: Apparently, cookies with samesite-attribute set to strict aren't handled very well in the context of progressive web applications. I configured the ASP.NET Identity Cookies to have samesite=lax, and problems disappeared.

Program.cs exerpt:

builder.Services.ConfigureApplicationCookie(o =>
{
    o.LoginPath = "/Identity/Account/Login";
    o.LogoutPath = "/Identity/Account/Logout";
    o.AccessDeniedPath = "/Identity/Account/AccessDenied";
    o.Cookie.MaxAge = TimeSpan.FromDays(6);
    o.Cookie.HttpOnly = true;

    o.Cookie.SameSite = SameSiteMode.Lax; // <=====

    o.Cookie.SecurePolicy = CookieSecurePolicy.Always;
    o.ExpireTimeSpan = TimeSpan.FromDays(6);
    o.SlidingExpiration = true;
});
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Flipps