symfony 4 jwt bundle check_login error 404 while debug match route

i’m actually on symfony4 and php7.2.9 with apache bundle. I’m trying to use lexikJWT bundle. I have tested the request with postman and curl command. The header is send in json (for the json_login function).
What ever i do i get a 404 error.
The configuration from the doc seem to be simple so i don’t understand what i’m doing wrong
/api/test is working
I have also noticed that the /api send me to the root directory
security.yaml

    providers:
        # used to reload user from session & other features (e.g. switch_user)
        app_user_provider:
            entity:
                class: AppEntityUser
                property: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        login_check:
            pattern: ^/api/login
            stateless: true
            anonymous: true
            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
            guard:
                authenticators:
                    - lexik_jwt_authentication.jwt_token_authenticator

routes.yaml

api_login_check:
    path: /api/login_check

php bin/console debug:router login_check:

+--------------+---------------------------------------------------------+
| Property     | Value                                                   |
+--------------+---------------------------------------------------------+
| Route Name   | login_check                                             |
| Path         | /api/login_check                                        |
| Path Regex   | #^/api/login_check$#sD                                  |
| Host         | ANY                                                     |
| Host Regex   |                                                         |
| Scheme       | ANY                                                     |
| Method       | POST                                                    |
| Requirements | NO CUSTOM                                               |
| Class        | SymfonyComponentRoutingRoute                         |
| Defaults     | NONE                                                    |
| Options      | compiler_class: SymfonyComponentRoutingRouteCompiler |
+--------------+---------------------------------------------------------+```


`php bin/console router:match /api/login_check`:
 [OK] Route "api_login" matches

+--------------+-----------------------------------------------------------+
| Property     | Value                                                     |
+--------------+-----------------------------------------------------------+
| Route Name   | api_login                                                 |
| Path         | /api/login_check                                          |
| Path Regex   | #^/api/login_check$#sD                                    |
| Host         | ANY                                                       |
| Host Regex   |                                                           |
| Scheme       | ANY                                                       |
| Method       | ANY                                                       |
| Requirements | NO CUSTOM                                                 |
| Class        | SymfonyComponentRoutingRoute                           |
| Defaults     | _controller: AppControllerSecurityController::api_login |
| Options      | compiler_class: SymfonyComponentRoutingRouteCompiler   |
+--------------+-----------------------------------------------------------+

If you have any advice i will take it !
Thx in advance

Source: Symfony4 Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *