title: How to store jwt token in localStorage and send it back to the server with header in express?
body: <p>I have read many articles in stackoverflow and have seen lots of youtube videos, but failed to find the example code which is demonstrating about the flow of <em>saving jwt to localstorage - send back to server with authorization header for verifying</em>.</p>
  
  <p>Here is what I want to do.</p>
  
  <p>When the client logs in to the server, server gives token and saves it to the client <code>localStorage</code> (or <code>sessionStorage</code>).</p>
  
  <p>Whenever the client calls an api which can be accessed only with the token,
  client retrieves the token back from the <code>localStorage</code>, and send that token with the authorization header (<code>req.headers.[x-access-token]</code> or <code>req.headers.[authorization]</code>) to the server.</p>
  
  <p>But all of the articles I've been read is explaining this issue with the Postman which does not show how to store it to the <code>localStorage</code> and put it in the authorization header.</p>
  
  <p>Do I have to use <code>localStorage.setItem</code> when the server gives the token to the client, and use and <code>localStorage.getItem</code> and <code>new Headers()</code> with <code>append()</code> or <code>axios</code> before sending that token back to the server?</p>
  
  <p>Examples don't have to be for the express user, but I'd like to get the glimpse of ideas.</p>