Search code examples
phpjsonjwtpostmansymfony4

Return JSON token from postman


I am implementing JWT into Symfony 4 project.

When I try following command using curl:

curl -X POST -H "Content-Type: application/json" http://localhost:8080/login -d "
{\"email\":\"[email protected]\",\"password\":\"admin\"}"

It is generating the token. But When I try it using postman, I am getting Token not found error

{
    "code": 401,
    "message": "JWT Token not found"
}

In Postman, I am using following params:

URL: http://localhost:8080/login
METHOD: POST
HEADERS >> KEY: Content-Type VALUE: application/json
BODY >> x-www-form-urlencoded
email & password

Can anybody please help me how can I get token from postman?


Solution

  • Cause your request must be json.

    You must send your data as raw. so in BODY tab select raw and place your plain json in it. see image:

    enter image description here