Lexik JWT Authentification with Sf4 : Uncaught Exception: Unable to find the controller for path...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I followed the Sf4 sandbox to install JWT Auth, but still I have this response :



2019-01-03T18:39:27+01:00 [info] Matched route "login_check".
2019-01-03T18:39:27+01:00 [info] Populated the TokenStorage with an anonymous Token.
2019-01-03T18:39:27+01:00 [warning] Unable to look for the controller as the "_controller" parameter is missing.
2019-01-03T18:39:27+01:00 [critical] Uncaught Exception: Unable to find the controller for path "/login_check". The route is wrongly configured.
[Thu Jan 3 18:39:27 2019] 127.0.0.1:48564 [404]: /login_check


When I try this command :




curl -X POST -H "Content-Type: application/json" http://localhost:8000/login_check -d '{"email":"johndoe@test.fr","password":"test"}'




Here is my routes.yaml :



index:
path: /
controller: AppControllerDefaultController::index

register:
path: /register
controller: AppControllerDefaultController::register
methods: POST

api:
path: /api
controller: AppControllerDefaultController::api

login_check:
path: /login_check
methods: [POST]


And here is my security.yaml :



security:
encoders:
AppEntityUser:
algorithm: bcrypt
cost: 12

# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
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

main:
anonymous: true

login:
pattern: ^/login
stateless: true
anonymous: true
json_login:
check_path: /login_check
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
username_path: email
password_path: password
api:
pattern: ^/
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator

# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }


I am using PHP7.2 and Symfony 4.2.
Does someone know how to correct this error ?



Thanks,



Adrien










share|improve this question





























    0















    I followed the Sf4 sandbox to install JWT Auth, but still I have this response :



    2019-01-03T18:39:27+01:00 [info] Matched route "login_check".
    2019-01-03T18:39:27+01:00 [info] Populated the TokenStorage with an anonymous Token.
    2019-01-03T18:39:27+01:00 [warning] Unable to look for the controller as the "_controller" parameter is missing.
    2019-01-03T18:39:27+01:00 [critical] Uncaught Exception: Unable to find the controller for path "/login_check". The route is wrongly configured.
    [Thu Jan 3 18:39:27 2019] 127.0.0.1:48564 [404]: /login_check


    When I try this command :




    curl -X POST -H "Content-Type: application/json" http://localhost:8000/login_check -d '{"email":"johndoe@test.fr","password":"test"}'




    Here is my routes.yaml :



    index:
    path: /
    controller: AppControllerDefaultController::index

    register:
    path: /register
    controller: AppControllerDefaultController::register
    methods: POST

    api:
    path: /api
    controller: AppControllerDefaultController::api

    login_check:
    path: /login_check
    methods: [POST]


    And here is my security.yaml :



    security:
    encoders:
    AppEntityUser:
    algorithm: bcrypt
    cost: 12

    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    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

    main:
    anonymous: true

    login:
    pattern: ^/login
    stateless: true
    anonymous: true
    json_login:
    check_path: /login_check
    success_handler: lexik_jwt_authentication.handler.authentication_success
    failure_handler: lexik_jwt_authentication.handler.authentication_failure
    username_path: email
    password_path: password
    api:
    pattern: ^/
    stateless: true
    guard:
    authenticators:
    - lexik_jwt_authentication.jwt_token_authenticator

    # Easy way to control access for large sections of your site
    # Note: Only the *first* access control that matches will be used
    access_control:
    # - { path: ^/admin, roles: ROLE_ADMIN }
    # - { path: ^/profile, roles: ROLE_USER }


    I am using PHP7.2 and Symfony 4.2.
    Does someone know how to correct this error ?



    Thanks,



    Adrien










    share|improve this question

























      0












      0








      0








      I followed the Sf4 sandbox to install JWT Auth, but still I have this response :



      2019-01-03T18:39:27+01:00 [info] Matched route "login_check".
      2019-01-03T18:39:27+01:00 [info] Populated the TokenStorage with an anonymous Token.
      2019-01-03T18:39:27+01:00 [warning] Unable to look for the controller as the "_controller" parameter is missing.
      2019-01-03T18:39:27+01:00 [critical] Uncaught Exception: Unable to find the controller for path "/login_check". The route is wrongly configured.
      [Thu Jan 3 18:39:27 2019] 127.0.0.1:48564 [404]: /login_check


      When I try this command :




      curl -X POST -H "Content-Type: application/json" http://localhost:8000/login_check -d '{"email":"johndoe@test.fr","password":"test"}'




      Here is my routes.yaml :



      index:
      path: /
      controller: AppControllerDefaultController::index

      register:
      path: /register
      controller: AppControllerDefaultController::register
      methods: POST

      api:
      path: /api
      controller: AppControllerDefaultController::api

      login_check:
      path: /login_check
      methods: [POST]


      And here is my security.yaml :



      security:
      encoders:
      AppEntityUser:
      algorithm: bcrypt
      cost: 12

      # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
      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

      main:
      anonymous: true

      login:
      pattern: ^/login
      stateless: true
      anonymous: true
      json_login:
      check_path: /login_check
      success_handler: lexik_jwt_authentication.handler.authentication_success
      failure_handler: lexik_jwt_authentication.handler.authentication_failure
      username_path: email
      password_path: password
      api:
      pattern: ^/
      stateless: true
      guard:
      authenticators:
      - lexik_jwt_authentication.jwt_token_authenticator

      # Easy way to control access for large sections of your site
      # Note: Only the *first* access control that matches will be used
      access_control:
      # - { path: ^/admin, roles: ROLE_ADMIN }
      # - { path: ^/profile, roles: ROLE_USER }


      I am using PHP7.2 and Symfony 4.2.
      Does someone know how to correct this error ?



      Thanks,



      Adrien










      share|improve this question














      I followed the Sf4 sandbox to install JWT Auth, but still I have this response :



      2019-01-03T18:39:27+01:00 [info] Matched route "login_check".
      2019-01-03T18:39:27+01:00 [info] Populated the TokenStorage with an anonymous Token.
      2019-01-03T18:39:27+01:00 [warning] Unable to look for the controller as the "_controller" parameter is missing.
      2019-01-03T18:39:27+01:00 [critical] Uncaught Exception: Unable to find the controller for path "/login_check". The route is wrongly configured.
      [Thu Jan 3 18:39:27 2019] 127.0.0.1:48564 [404]: /login_check


      When I try this command :




      curl -X POST -H "Content-Type: application/json" http://localhost:8000/login_check -d '{"email":"johndoe@test.fr","password":"test"}'




      Here is my routes.yaml :



      index:
      path: /
      controller: AppControllerDefaultController::index

      register:
      path: /register
      controller: AppControllerDefaultController::register
      methods: POST

      api:
      path: /api
      controller: AppControllerDefaultController::api

      login_check:
      path: /login_check
      methods: [POST]


      And here is my security.yaml :



      security:
      encoders:
      AppEntityUser:
      algorithm: bcrypt
      cost: 12

      # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
      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

      main:
      anonymous: true

      login:
      pattern: ^/login
      stateless: true
      anonymous: true
      json_login:
      check_path: /login_check
      success_handler: lexik_jwt_authentication.handler.authentication_success
      failure_handler: lexik_jwt_authentication.handler.authentication_failure
      username_path: email
      password_path: password
      api:
      pattern: ^/
      stateless: true
      guard:
      authenticators:
      - lexik_jwt_authentication.jwt_token_authenticator

      # Easy way to control access for large sections of your site
      # Note: Only the *first* access control that matches will be used
      access_control:
      # - { path: ^/admin, roles: ROLE_ADMIN }
      # - { path: ^/profile, roles: ROLE_USER }


      I am using PHP7.2 and Symfony 4.2.
      Does someone know how to correct this error ?



      Thanks,



      Adrien







      php symfony4 lexikjwtauthbundle






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 7:38









      adrilefadrilef

      152




      152
























          2 Answers
          2






          active

          oldest

          votes


















          0














          In security.yaml put login firewall at the first place



          firewalls:
          login:
          #login context

          #other firewalls





          share|improve this answer
























          • That worked for me, thanks a lot.

            – adrilef
            Jan 4 at 12:22



















          0














          In security.yaml, remove



          main:
          anonymous: true





          share|improve this answer


























          • While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

            – Nick
            Jan 17 at 3:14












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034809%2flexik-jwt-authentification-with-sf4-uncaught-exception-unable-to-find-the-con%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          In security.yaml put login firewall at the first place



          firewalls:
          login:
          #login context

          #other firewalls





          share|improve this answer
























          • That worked for me, thanks a lot.

            – adrilef
            Jan 4 at 12:22
















          0














          In security.yaml put login firewall at the first place



          firewalls:
          login:
          #login context

          #other firewalls





          share|improve this answer
























          • That worked for me, thanks a lot.

            – adrilef
            Jan 4 at 12:22














          0












          0








          0







          In security.yaml put login firewall at the first place



          firewalls:
          login:
          #login context

          #other firewalls





          share|improve this answer













          In security.yaml put login firewall at the first place



          firewalls:
          login:
          #login context

          #other firewalls






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 4 at 11:29









          Roman LitvinovRoman Litvinov

          1819




          1819













          • That worked for me, thanks a lot.

            – adrilef
            Jan 4 at 12:22



















          • That worked for me, thanks a lot.

            – adrilef
            Jan 4 at 12:22

















          That worked for me, thanks a lot.

          – adrilef
          Jan 4 at 12:22





          That worked for me, thanks a lot.

          – adrilef
          Jan 4 at 12:22













          0














          In security.yaml, remove



          main:
          anonymous: true





          share|improve this answer


























          • While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

            – Nick
            Jan 17 at 3:14
















          0














          In security.yaml, remove



          main:
          anonymous: true





          share|improve this answer


























          • While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

            – Nick
            Jan 17 at 3:14














          0












          0








          0







          In security.yaml, remove



          main:
          anonymous: true





          share|improve this answer















          In security.yaml, remove



          main:
          anonymous: true






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 17 at 5:27









          Tedinoz

          1,38921419




          1,38921419










          answered Jan 17 at 2:16









          Jan SpäthJan Späth

          1




          1













          • While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

            – Nick
            Jan 17 at 3:14



















          • While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

            – Nick
            Jan 17 at 3:14

















          While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

          – Nick
          Jan 17 at 3:14





          While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review

          – Nick
          Jan 17 at 3:14


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034809%2flexik-jwt-authentification-with-sf4-uncaught-exception-unable-to-find-the-con%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas