title: Sails JS - Remove existing JWT
body: <p>I followed this tutorial <a href="https://ericswann.wordpress.com/2015/04/24/nozus-js-1-intro-to-sails-with-passport-and-jwt-json-web-token-auth/" rel="nofollow">https://ericswann.wordpress.com/2015/04/24/nozus-js-1-intro-to-sails-with-passport-and-jwt-json-web-token-auth/</a> and I got it working just fine. The only thing left missing is the logout functionallity. I read that I could just delete the token from the client side, but still I think it'd be a better approach to also remove it from the server.</p>
  
  <p>This is my AuthController.js</p>
  
  <pre><code>var passport = require('passport');
  //Triggers when user authenticates via passport
  function _onPassportAuth(req, res, error, user, info) {
      if (error) return res.serverError(error);
      if (!user) return res.unauthorized(null, info &amp;&amp; info.code, info &amp;&amp; info.message);
      return res.ok({
          // TODO: replace with new type of cipher service
          token: HashService.createToken(user),
          user: user
      });
  }
  
  module.exports = {
      signup: function (req, res) {
          User.create(_.omit(req.allParams(), 'id')).then(function (user) {
              return {
                  // TODO: replace with new type of cipher service
                  token: HashService.createToken(user),
                  user: user
              };
          }).then(res.created).catch(res.serverError);
      },
  
      signin: function (req, res) {
          passport.authenticate('local', _onPassportAuth.bind(this, req, res))(req, res);
      }
  };
  </code></pre>
  
  <p>How can I destroy a token?</p>