I'm trying to update User's roles after the user confirms its phone number.
I make the update in the database:
$user->setRoles(["ROLE_USER"]);
$em->persist($user);
That works fine and updates the users's role in the database. (Before, users have "ROLE_UNACTIVATED" group).
However, it doesn't update the user's roles in the session (security token), so the user needs to logout and then log in one more time.
So, the question is how to update User's roles in security token?