title: Can we use JWT for Session management?
body: <p>After introducing JWT in my own application. I am facing some issues, might be I do it in wrong way. Please Suggest me the best way of implementation. </p>
  
  <p><strong>Technology Stack : (MERN) MongoDB Expressjs React Node.</strong></p>
  
  <p>After successfully login , I am creating a new JWT token by adding "user-id" in to it and return back to UI layer. At UI end I am storing that token in session storage. This token I am using for all further requests to the server. Before going to the controller I am checking Token in middleware for validtaion by using JWT verify. if successfully verified then next() else return an error with an invalid token.</p>
  
  <p>Issue accurs now :</p>
  
  <ol>
  <li>Register with <strong>USER 1</strong></li>
  <li>Login with <strong>USER 1</strong></li>
  <li>After successfully login copy Token from session storage. </li>
  <li>Then Logout <strong>USER 1</strong></li>
  <li>Register with <strong>USER 2</strong></li>
  <li>Login with <strong>USER 2</strong></li>
  <li>Paste in session storage Token of <strong>USER 1</strong> into <strong>USER 2</strong></li>
  <li>After refreshing a page <strong>USER 1</strong> dashboard again instead of <strong>USER 2</strong>.</li>
  </ol>
  
  <p>Any help or suggestions for following two points:</p>
  
  <blockquote>
    <ul>
    <li>How should I manage user Session by JWT? </li>
    <li>How should I manage API Authentication by JWT?</li>
    </ul>
  </blockquote>