2

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

1
  • That cannot be the default behavior. That usually happens if: you keep your session data in var/cache/<<end>>/sessions and you invoke cache:clear. Commented Aug 24, 2020 at 11:36

1 Answer 1

3

Reload the user programatically using TokenStorageInterface, create new UsernamePasswordToken (or whichever you are using) and replace the current one with $tokenStorage->setToken($newToken);.

Sign up to request clarification or add additional context in comments.

1 Comment

Image
Thanks. Works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.