Answer the question
In order to leave comments, you need to log in
How to authorize a user by id?
How to authorize a user by id ?
Answer the question
In order to leave comments, you need to log in
Decision:
$user = $this->getDoctrine()->getRepository(User::class)->find(1);
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
$tokenStorage = $this->get('security.token_storage');
$tokenStorage->setToken($token);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question