I am using ASP.NET Core RC1 with Facebook authentication and window cookie highlighting created as follows:
app.UseIdentity(); app.UseFacebookAuthentication();
and
services.AddIdentity<ApplicationUser, IdentityRole>((options => { options.Cookies.ApplicationCookie.CookieName = "myauthcookie"; options.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromDays(5); options.Cookies.ApplicationCookie.SlidingExpiration = true; })) .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders();
This works great the first time a user logs in - the cookie expires correctly. However, when the user returns to the page, the expiration of the cookie is set to "Session", so in practice the user must re-authenticate every other visit.
Why is this happening? I did not configure it correctly?
Update : I already did some testing without SlidingExpiration, and the problem remains the same. Upon returning to the page, the expiration of the cookie changes to "Session". I am using Chrome.
Also, I do not work on https. Could this be a factor?
source share