title: Where does json web token save the data?
body: <p>I have a node-app using json web token:</p>
  
  <p>var jwt = require('jsonwebtoken');</p>
  
  <p>If a login succedes then this library creates a token this way:</p>
  
  <pre><code>var payload = {mydata: 'abcd'};
  var token = jwt.sign(payload, 'secret', {
      expiresIn: 28800
  });
  
  return {
      success: true,
      message: 'Success',
      token: token
  };
  </code></pre>
  
  <p>What I don't understand is where the token is stored on the server.
  If the same user that received the token makes a call to a protected resource, then I have this line:</p>
  
  <pre><code>jwt.verify(token_sent_by_used, 'secret', function (err, res) {
      if(!err){
          res.json({result: 'success'});
      }
      else{
          res.json({result: 'failure'});
      }
  }
  </code></pre>
  
  <p>The reason why Im asking this is that I could not find explanation on how to handle jwt when running an application across several machines.
  If my backend is put on different machines and user makes the requests to a load balancer, then the request can hit any machine.
  If jwt writes token data on the file system, then I guess there can be issue if the request hits a machine that was not the one that created the token.
  When using session, you can set the session handler to database. How do you solve this with jwt?</p>
  
  <p>****EDIT****</p>
  
  <p>Ok, let's take an eaxmple.
  I have a node app that is running on machine .10 and the same node app also running on machine .11. Two different machines.</p>
  
  <p>I go to machine .10 and send username password. App on machine .10 checks username/password. They are ok. Machine .10 creates a jwt token and send it to me.</p>
  
  <p>I now make a curl request (to a resource that requires a valid jwt-token) to machine .11 and send the jwt-token that machine .10 had preciously sent to me. Machine .11 will not complain about the jtw-token? It will be considered valid? Even if it was not created on machine .11?</p>