Anyone who has implemented a "keep me signed in" functionality for customer sign in?

We would like to have an option for customers to be able to get automatically signed in when they return to our website. Like a checkbox on the sign in page with a label like “Keep me signed in”. If the customer check the checkbox, the customer will be automatically signed in if the customer returns to the website within, say 30 days.

Anyone who has implemented something like that for the Litium 8 MVC Accelerator and want to share how you did it?

Litium version: 8

We reached out to Litium support and got some suggestions. We then managed to solve this by using the HttpContext

We first use the LoginService to sign in the user. We then use the HttpContext to first sign out and then sign in the user again. When using the methods on the HttpContext it is possible to set authentication properties, for example the expiration time at which the authentication ticket should expire.

await context.SignOutAsync(IdentityConstants.ApplicationScheme);
await context.SignInAsync(IdentityConstants.ApplicationScheme, context.User, new() { IsPersistent = true });

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