How to create JWT token in Symfony5?
I'm trying to create REST API with JWT authentification in Symfony5. At first I've tried to do as written here https://h-benkachoud.medium.com/symfony-rest-api-without-fosrestbundle-using-jwt-authentication-part-2-be394d0924dd . Difficulties appeared when I've tried to make method getTokenUser: /** * @param JWTTokenManagerInterface $JWTManager * @return JsonResponse * @Route("/api/login_check", name="api_login_check", methods={"POST"}) */ public function getTokenUser(UserInterface $user,JWTTokenManagerInterface $JWTManager) { return new JsonResponse(['token' => $JWTManager->create($user)]); }
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.