title: Why is req.cookies undefined?
body: <p><strong>SITUATION:</strong> </p>
  
  <p>I am trying to check if my user is authenticated when he makes a request to the server.</p>
  
  <p>I googled a bit and found this: </p>
  
  <p><a href="https://stackoverflow.com/questions/39243578/how-to-show-different-page-if-user-is-logged-in-via-firebase">How to show different page if user is logged in via firebase</a></p>
  
  <p>So here's my try at implementing this solution using this library:</p>
  
  <p><a href="https://github.com/js-cookie/js-cookie/blob/latest/src/js.cookie.js" rel="noreferrer">https://github.com/js-cookie/js-cookie/blob/latest/src/js.cookie.js</a></p>
  
  <hr>
  
  <p><strong>CODE:</strong></p>
  
  <p>server-side</p>
  
  <pre><code>  var cookies = require("cookie-parser");
  
    router.get("/", function(req, res, next){
  
  
        const { token } = req.cookies;
  
        console.log('Verifying token', token);
  
  
   });
  </code></pre>
  
  <p>client-side</p>
  
  <pre><code>&lt;script src="/public/js/cookieScript.js"&gt; &lt;/script&gt;
  
  &lt;a href="/upload" class = "authIn uploadButton btn btn-success pull-right"&gt;UPLOAD&lt;/a&gt;
  
  &lt;script&gt;
  
          const setAppCookie = () =&gt; firebase.auth().currentUser &amp;&amp;
              firebase.auth().currentUser.getToken().then(token =&gt; {
                  Cookies.set('token', token, {
                      domain: window.location.hostname,
                      expire: 1 / 24, // One hour
                      path: '/',
                      secure: true // If served over HTTPS
               });
          });
  
  &lt;/script&gt;
  </code></pre>