Monday, June 29, 2020

how to test JWT token with CURL in command line?

after we implement api to load the JWT with basic authentication via login form that requried user to provide email and password in order to access the api with JWT authorization.

it is very to easy to test the logic by executing the following command line in CMD/cmder

curl -d "email=test@email.com&password=test1234" http://localhost:3000/api/login

the output is below indicating that the JWT token is generated with provided login information.

λ curl -d "email=test@email.com&password=test1234" http://localhost:3000/api/login
{"success":true,"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjoiNW
VmYTA5ZWEzMGE2ZTAwYzIwMmJhNjhiIiwiZXhwIjoxNTkzNTQ0NDM4NzE2L
CJpYXQiOjE1OTM0NTgwMzh9.IHTlnRuOg_AlppmraGMY8xibrGNAoGGSMA3yGx_2DmI"}

No comments:

Post a Comment