title: LexikJWTAuthenticationBundle return user AND token
body: <p>I use api plateform, i have install LexikJWTAuthenticationBundle for my authentification.</p>
  <p>my file security.yaml</p>
  <pre><code>security:
      encoders:
          App\Entity\User:
              algorithm: auto
      providers:
          app_user_provider:
              entity:
                  class: App\Entity\User
                  property: email
      firewalls:
          login:
              pattern: ^/api/login_check
              stateless: true
              anonymous: true
              provider: app_user_provider
              json_login:
                  check_path: api_login_check
                  success_handler: lexik_jwt_authentication.handler.authentication_success
                  failure_handler: lexik_jwt_authentication.handler.authentication_failure
          api:
              pattern:   ^/api
              stateless: true
              anonymous: true
              provider: app_user_provider
              guard:
                  authenticators:
                      - lexik_jwt_authentication.jwt_token_authenticator
          dev:
              pattern: ^/(_(profiler|wdt)|css|images|js)/
              security: false
          classrooms:
              pattern:  ^/api/classrooms
              stateless: true
              anonymous: true
          schools:
              pattern:  ^/api/schools
              stateless: true
              anonymous: true
      access_control:
          - { path: ^/api/login_check, roles: PUBLIC_ACCESS }
  
  </code></pre>
  <p>routes.yaml</p>
  <pre><code>api_login_check:
      path: /api/login_check
  </code></pre>
  <p>When i call my endpoint api/login_check, i have response with user AND token jwt.</p>
  <p>Is not a valid response : {}{}</p>
  <p>It's my response with postman :</p>
  <pre><code>{
  &quot;username&quot;: &quot;student@student.com&quot;,
  &quot;password&quot;: &quot;password&quot;
  }{&quot;token&quot;:&quot;eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2MzkwNzYwMjMsImV4cCI6MTYzOTA3OTYyMywicm9sZXMiOlsiUk9MRV9TVFVERU5UIiwiUk9MRV9VU0VSIl0sInVzZXJuYW1lIjoic3R1ZGVudEBzdHVkZW50LmNvbSIsInVzZXJfaWQiOjIsImVtYWlsIjoic3R1ZGVudEBzdHVkZW50LmNvbSIsInN0dWRlbnRfaWQiOjF9.rKHalyplwGq6gUr0MuXSHOOWhuRisHwbCUj8XXWxEOqmpnzU37W17SMc9kY_1t44lNdYpetU1mDKW0K9qOLyJ5rrRcvEMgUSiY6F0jG8LvwYbfHyncaztoKL4L9k_uUSuzOh0k8tb1L7cOmdNhYVelPcJ_4_Y0NDxu7Yd2iK9rjTsXYqwfo5xSMVyyRJR3WkSitVbB2WD1MPD9yA5Awb9YANtt_X3KPJJXTH9ma_dc7RVNWBxhnEBqg4v5oHRFiE8gAM0R4AyrrfoFYjt27AuEvQ5XFqFBMWTWG4iQYjiLjheNIUAnADRwiIsTlE6G7xLdZUrl_CJdVtZfYbBA0yQQ&quot;}
  </code></pre>
  <p>when i have bad credentials:</p>
  <pre><code>{
  &quot;username&quot;: &quot;student@student4.com&quot;,
  &quot;password&quot;: &quot;password&quot;
  }{&quot;code&quot;:401,&quot;message&quot;:&quot;Invalid credentials.&quot;}
  </code></pre>
  <p>I need response with correct format json (token only), i don't want user. I have this problem only on my prod server.</p>
  <p>my docker containers:</p>
  <pre><code>CONTAINER ID   IMAGE                        COMMAND                  CREATED        STATUS        PORTS                                                    NAMES
  dae2d40b1b85   docker-teacher-tool_php      &quot;docker-php-entrypoi…&quot;   12 hours ago   Up 12 hours   0.0.0.0:9000-&gt;9000/tcp, :::9000-&gt;9000/tcp                teacher-tool-php
  adb596651e38   nginx:stable-alpine          &quot;/docker-entrypoint.…&quot;   12 hours ago   Up 12 hours   0.0.0.0:8000-&gt;80/tcp, :::8000-&gt;80/tcp                    docker-teacher-tool_nginx_1
  9ca8840fdbd3   phpmyadmin                   &quot;/docker-entrypoint.…&quot;   12 hours ago   Up 12 hours   0.0.0.0:8080-&gt;80/tcp, :::8080-&gt;80/tcp                    docker-teacher-tool_phpmyadmin_1
  7d50a994cfa2   docker-teacher-tool_nodejs   &quot;docker-entrypoint.s…&quot;   12 hours ago   Up 12 hours   0.0.0.0:3000-&gt;3000/tcp, :::3000-&gt;3000/tcp                docker-teacher-tool_nodejs_1
  41ba41f25dbf   dunglas/mercure:v0.10.4      &quot;/mercure&quot;               12 hours ago   Up 12 hours   443/tcp, 0.0.0.0:3001-&gt;80/tcp, :::3001-&gt;80/tcp           docker-teacher-tool_mercure_1
  d30a709aef60   mysql:8.0                    &quot;docker-entrypoint.s…&quot;   12 hours ago   Up 12 hours   33060/tcp, 0.0.0.0:49157-&gt;3306/tcp, :::49157-&gt;3306/tcp   docker-teacher-tool_database_1
  </code></pre>
  <p>Edit security.yaml</p>
  <pre><code>security:
      encoders:
          App\Entity\User:
              algorithm: auto
      providers:
          app_user_provider:
              entity:
                  class: App\Entity\User
                  property: email
      firewalls:
          login:
              pattern: ^/api/login
              stateless: true
              anonymous: true
              provider: app_user_provider
              json_login:
                  check_path: api_login_check
                  success_handler: lexik_jwt_authentication.handler.authentication_success
                  failure_handler: lexik_jwt_authentication.handler.authentication_failure
          api:
              pattern:   ^/api
              stateless: true
              anonymous: true
              provider: app_user_provider
              guard:
                  authenticators:
                      - lexik_jwt_authentication.jwt_token_authenticator
          # dev:
          #     pattern: ^/(_(profiler|wdt)|css|images|js)/
          #     security: false
          classrooms:
              pattern:  ^/api/classrooms
              stateless: true
              anonymous: true
          schools:
              pattern:  ^/api/schools
              stateless: true
              anonymous: true
      access_control:
          # - { path: ^/api/login_check, roles: PUBLIC_ACCESS }
  
  </code></pre>
  <p>in my var/log/nginx/project_error.log</p>
  <pre><code>PHP message: [debug] SELECT t0.id AS id_1, t0.email AS email_2, t0.roles AS roles_3, t0.password AS password_4, t0.first_name AS first_name_5, t0.last_name AS last_name_6, t0.created_at AS created_at_7, t8.id AS id_9, t8.user_id AS user_id_10, t11.id AS id_12, t11.user_id AS user_id_13 FROM user t0 LEFT JOIN teacher t8 ON t8.user_id = t0.id LEFT JOIN student t11 ON t11.user_id = t0.id WHERE t0.email = ? LIMIT 1
  PHP message: [debug] SELECT t0.id AS id_1, t0.type AS type_2 FROM role t0 INNER JOIN role_user ON t0.id = role_user.role_id WHERE role_user.user_id = ?
  PHP message: [info] User has been authenticated successfully.
  PHP message: [debug] Notified event &quot;lexik_jwt_authentication.on_jwt_created&quot; to listener &quot;App\EventSubscriber\JWTSubscriber::onLexikJwtAuthenticationOnJwtCreated&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Symfony\Component\HttpKernel\EventListener\ValidateRequestListener::onKernelRequest&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Nelmio\CorsBundle\EventListener\CorsListener::onKernelRequest&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelRequest&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Symfony\Component\HttpKernel\EventListener\LocaleListener::setDefaultLocale&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;ApiPlatform\Core\EventListener\QueryParameterValidateListener::onKernelRequest&quot;.
  PHP message: [debug] Notified event &quot;kernel.request&quot; to listener &quot;Symfony\Component\HttpKernel\EventListener\LocaleListener::onKerne
  2021/12/09 20:25:10 [error] 31#31: *109 FastCGI sent in stderr: &quot;PHP message: [error] Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: &quot;No route found for &quot;GET /&quot;&quot; at /var/www/symfony_docker/vendor/symfony/http-kernel/EventListener/RouterListener.php line 136&quot; while reading response header from upstream, client: 88.9.119.217, server: localhost, request: &quot;GET / HTTP/1.1&quot;, upstream: &quot;fastcgi://172.18.0.6:9000&quot;, host: &quot;146.59.237.234:8000&quot;
  </code></pre>
  <p>my nginx config:</p>
  <pre><code>server {
      client_max_body_size 500M;
  
      listen 80;
      index index.php;
      server_name localhost;
      root /var/www/symfony_docker/public;
      error_log /var/log/nginx/project_error.log;
      access_log /var/log/nginx/project_access.log;
  
      location / {
          try_files $uri /index.php$is_args$args;
      }
  
      location ~ ^/index\\.php(/|$) {
          fastcgi_pass php:9000;
          fastcgi_split_path_info ^(.+\\.php)(/.*)$;
          include fastcgi_params;
  
          fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
          fastcgi_param DOCUMENT_ROOT $realpath_root;
  
          fastcgi_buffer_size 128k;
          fastcgi_buffers 4 256k;
          fastcgi_busy_buffers_size 256k;
  
          internal;
      }
  
      location ~ \\.php$ {
          return 404;
      }
  
  }
  </code></pre>