0

In my Symfony 3.4 Application I am trying to use LexikJWTAuthenticationBundle (v2.6.3). I installed and configured it and created the needed keys like said on the github page: https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md#getting-started

They provide a test curl command there to check if it works:

curl -X POST -H "Content-Type: application/json" http://localhost/api/login_check -d '{"username":"johndoe","password":"test"}'

This command allways returns a 302 and a small html-page redirecting to "../api/login". This happens when entering falsy user data as well as when entering user credentials for an existing valid user. This also happens on all other pathes that start with "../api/".

What I expect "../api/login_check" to return is a token like

{
   "token" : "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE0MzQ3Mjc1MzYsInVzZXJuYW1lIjoia29ybGVvbiIsImlhdCI6IjE0MzQ2NDExMzYifQ.nh0L_wuJy6ZKIQWh6OrW5hdLkviTs1_bau2GqYdDCB0Yqy_RplkFghsuqMpsFls8zKEErdX5TYCOR7muX0aQvQxGQ4mpBkvMDhJ4-pE4ct2obeMTr_s4X8nC00rBYPofrOONUOR4utbzvbd4d2xT_tj4TdR_0tsr91Y7VskCRFnoXAnNT-qQb7ci7HIBTbutb9zVStOFejrb4aLbr7Fl4byeIEYgp2Gd7gY"
}

I am a bit stuck here on how to go on. Any help is much appreciated.

user3440145
  • 793
  • 10
  • 34

1 Answers1

0

It's a syntax problem - this curl call works fine

curl -X POST -H "Content-Type: application/json" http://localhost/api/login_check -d "{\"username\":\"johndoe\",\"password\":\"test\"}"

Found it here (thanks to @ElGecko_76): Invalid JSON Message while using LexikJWTAuthenticationBundle

user3440145
  • 793
  • 10
  • 34