M
M
Maxim Karpov2020-01-15 15:19:09
Facebook
Maxim Karpov, 2020-01-15 15:19:09

How to login via FB using JWT?

I'm trying in Symfony 3.4 to authorize via Facebook using JWT. But for some reason, JWT creates a token simply in text form, which causes an error:

Argument 2 passed to Symfony\Component\Security\Http\Event\InteractiveLoginEvent::__construct() must implement interface
Symfony\Component\Security\Core\Authentication\Token\TokenInterface, string given

// Если пользователь уже был создан ранее
$token = $this->get('lexik_jwt_authentication.jwt_manager')->create($user);
$user->setToken($token);
$event = new InteractiveLoginEvent($request, $token);
$this->get("event_dispatcher")->dispatch("security.interactive_login", $event);
return $this->redirectToRoute('homepage');

How to create a token with the TokenInterface interface using JWT so that you can authorize the user?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question