Reputation: 149
When changing user roles (in database or via code) user is getting logged out automatically. Is there a way to prevent this behaviour?
Using Symfony 5.1.2
Upvotes: 2
Views: 1954
Reputation: 514
Reload the user programatically using TokenStorageInterface
, create new UsernamePasswordToken
(or whichever you are using) and replace the current one with $tokenStorage->setToken($newToken);
.
Upvotes: 3