title: Save token and user in session with vue and express
body: <p>I tried to make an authentication system. Everything goes ok but it is a small problem, the user is disconnected every time he refreshes the page. I think I have somehow saved the token and the user in a session but I do not know how.</p>
  
  <p>Full project is here: <a href="https://github.com/gnome1337/coworking-lab/tree/Authentification" rel="nofollow noreferrer">Github</a></p>
  
  <pre><code>// Token setup
  function jwtSignUser(user) {
      const ONE_WEEK = 60 * 60 * 24 * 7;
      return jwt.sign(user, process.env.JWT_SECRET, {
      expiresIn: ONE_WEEK
    });
  }
  </code></pre>
  
  <p><strong>How I send the data</strong></p>
  
  <pre><code>// Successfuly logged in
      if (response) {
        return res.send({
          user: existingUser.toJSON(),
          token: jwtSignUser(existingUser.toJSON())
        });
      }
  </code></pre>
  
  <p>Solution:
  I solved this problem, you can find final project here
  <a href="https://github.com/gnome1337/coworking-lab/tree/Authentification" rel="nofollow noreferrer">Github</a></p>
  
  <p>I changed method of saving token to localStorage</p>