title: Handlebars and JWT token to local storage
body: <p>I am using express-handlebars and jwt tokens for a login route. I am trying to store the token in local storage upon hitting a login route on my api. The problem is when I set the token in the front end it creates an error due to its format. My code is below and if anyone has a fix or ideas that would be great. Thanks!
  Front end: (in handlebars template)</p>
  
  <pre><code>{{#if auth.token}}
  &lt;script type="text/javascript" async&gt;
  const token = {{auth.token}};
  localStorage.setItem("token", token)
  &lt;/script&gt;
  {{/if}}
  </code></pre>
  
  <p>Backend, saving token and sending with render:</p>
  
  <pre><code>jwt.sign(
                payload,
                keys.JWT_KEY,
                { expiresIn: 3600 },
                (err, token) =&gt; {
                  auth.token = token;
                  auth.status = true;
                  res.render("home", { auth: auth });
                }
              );
  </code></pre>
  
  <p>The error is Syntax error: invalid or unexpected token. </p>