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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!