Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/checkUser/:username/:password', function(req, res){
- db.run("select * from userslab3 where username = $1 and password = crypt($2, password)",
- [req.params.username, req.params.password], function(err, result){
- console.log(result);
- console.log(err);
- if(result[0].username == req.params.username)
- {
- // If username is there, return JWT with set of claims
- var token = jwt.sign(result[0], SECRET, {expiresIn: 1440});
- res.json({
- success: true,
- message:"Token given",
- token: token
- });
- }// end if
- else{
- console.log(result[0].username);
- }
- });
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement