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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started