Question: Do it in node.js and JWT 1) input JSON to the URL: http://localhost:3000/api/login with POST { username: test, password: 1234 } 2) Check whether the
Do it in node.js and JWT 1) input JSON to the URL: http://localhost:3000/api/login with POST
{
"username": "test",
"password": "1234"
}
2) Check whether the username and password are matched with "test" and "1234".
if they are matched then generate a TOKEN
{
"message": "Authenticated! Use this token in the \"Authorization\" header",
"token": "eyJhbG......jzdPzS8GI"
}
if they are not matched then show JSON with the message "Invalid Username or Password"
{
"message": "Invalid Username or Password",
"user": {
"username": "test",
"password": "134"
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
