title: Should I verify a JWT token information from a Database?
body: <p>I'm currently trying to build a REST API using express, node, and MongoDB. Now for authentication, I'm using JWT. </p>
  
  <p>Here is the code for checking JWT token</p>
  
  <pre><code> const token = req.headers['authorization'];
   if (token){
      const tokens = token.split(' ');
      const key = tokens[1];
      jwt.verify(key, config.jwtKey, (err, authData) =&gt; {
          if (err){
              res.status(403).json({
                  success: false,
                  message: "Authentication2 failed"
              });
          }
          // User authenticated 
          // Do something
          next();
      });
    } else {
      res.status(403).json({
          success: false,
          message: "Authentication failed"
      });
  }
  </code></pre>
  
  <p>Now, this code is working perfectly.</p>
  
  <p>For making the JWT, here is the code</p>
  
  <pre><code>........
  ........
  const token = jwt.sign(
  {
     email: user[0]._email,
     userId: user[0]._id
  }, config.jwtKey,{ expiresIn: "1d" });
  ........
  ........
  </code></pre>
  
  <p>Now my question is should I also verify the user by checking the existence of the user's information in the database to make it more secure? </p>
  
  <p>For example, searching the <code>email</code> and <code>userId</code> to my database.</p>
  
  <p>I'm using node, express, MongoDB, Mongoose, and JWT for this project.</p>