Prevent a user from being logged in on multiple devices

Our customer has requested a feature to prevent users from logging into the same account on multiple devices simultaneously. Does anyone have suggestions on how this limitation could be implemented?

Litium version: 8.17

Change the identity security stamp and all other signed in instances will be logged out.

Is this for MVC Or Storefront API?

MVC Accelerator on serverless.

Then you should be able to do something like this in your controller code.

var signInManager = HttpContext.RequestServices.GetService<SignInManager<ApplicationUser>>();
var applicationUser = await signInManager.UserManager.GetUserAsync(HttpContext.User);
await signInManager.UserManager.UpdateSecurityStampAsync(applicationUser);

Regarding to asp.net core - Change of Security Stamp - Stack Overflow the default validation timeout for the security stamp is 30 minutes but can be configured in your startup.

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