Error: Unable to find the controller for path "/login_check". The route is wrongly configured. (LexikJWTAuthentication)

You have wrong name for content-type header in your test request. It should have name CONTENT_TYPE.

$client->request(
   'POST',
   '/login_check',
   ['_username' => 'lexik', '_password' => 'dummy'],
   [],
   ['CONTENT_TYPE' => 'application/json']
);

Checking is here: vendor/symfony/security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php::handle

if (false === strpos($request->getRequestFormat(), 'json')
   && false === strpos($request->getContentType(), 'json')
) {
  return;
}

It helps in your "bug reproduced" code at least.


Make sure that /login_check is behind a firewall /login_check path has to match a firewall pattern. change this

access_control:

- { path: ^/your-route-for-login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }

to

access_control:

- { path: ^/your-route-for-login$, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }

i tried :P