title: Read express session cookie from React js app
body: <p>I'm building a project with authentication. I'm using Node+React. I set an express session cookie on the back-end and I want a component in react to read that cookie to see if the user is authenticated or not. For some reason I can not access that cookie from the react(client-side)... Maybe someone could help out?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>BACK:
  app.use(session({
    name: process.env.SESS_NAME,
    resave: false,
    saveUninitialized: false,
    secret: process.env.SESS_SECRET,
    cookie: {
      maxAge: parseInt(process.env.SESS_LIFETIME),
      sameSite: true, //strict,
      secure: process.env.NODE_ENV === "production"
    }
  }))
  
  FRONT:
  import Cookies from "js-cookie";
  ...
  console.log("cookie", Cookies.get("sid"));</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have a cookie named "sid" in this case and I can see it in my console in the browser... but when I try to access it its undefiend</p>
  
  <p><a href="https://i.stack.imgur.com/nILsj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nILsj.png" alt="enter image description here"></a>
  thanks!</p>