title: NodeJS and Firebase Redirect After Login - currentUser returns Null
body: <p>I am trying to embed my JS Firebase app with nodejs. As I am new with Nodejs. (Not Using Admin SDK)</p>
  
  <p>After loggedIN <code>onAuthStateChanged()</code> is returning null in server.js, but in app.js (Where login code is written) is printing the user details. </p>
  
  <p>Here is reference to related previous problem: <a href="https://stackoverflow.com/questions/45144678/node-js-keeps-redirecting-middleware/45145045?noredirect=1#comment77285737_45145045">Reference</a></p>
  
  <p>App.js code (That is printing user fine)</p>
  
  <pre><code> firebase.auth().onAuthStateChanged(firebaseUser =&gt; {
     if (firebaseUser) {
            currentUserID = firebase.auth().currentUser.uid;
            localStorage.setItem("currentUserID", currentUserID);
            console.log(currentUserID);
      }else{
            $('.signupform').show("slide");
            $('.signupform2').hide("slide");
            $('.loginform').show();
      }
    });
  </code></pre>
  
  <p>Server.js Code (Printing Null in console)</p>
  
  <pre><code>firebase.auth().onAuthStateChanged(firebaseUser =&gt; {
      console.log(firebase.auth().currentUser);
      console.log(firebaseUser);
  
      if (firebaseUser) {
          signed = true;
  
      }else{
          signed = false;
      }
    });
  </code></pre>
  
  <p>I am trying to implement isAuthenticated method mentioned in my <a href="https://stackoverflow.com/questions/45144678/node-js-keeps-redirecting-middleware/45145045?noredirect=1#comment77285737_45145045">previous question</a></p>
  
  <p>Any help would be highly appreciated. Thanks</p>