Monday, 24 April 2017

check if database contains username and password from token

function tokenIsValid(token){
    // TODO check if database contains username and password from token
    return true;
    // if no match was found
    return false;
}

Using sqlite3 db with body parser while, need help with that function don't know where to begin.

Also this is my token valid post

app.post('/is-token-valid', function(req,res) {
    console.log("is-token-valid", req.body, req.body.token)
  if (!req.body.token) {
  } else {
    var decoded = jwt.verify(req.body.token, 'shhhhh11');
        if (tokenIsValid(decoded)) {
            res.end('valid');
        } else {
            res.end('not-valid');
        }
  }
});



via Fuzzy Cat

No comments:

Post a Comment