title: How to show different page if user is logged in via firebase
body: <p>I have a slight problem, and it seems to be an easy one, but I cannot seem to wrap my head around what to do.</p>
  
  <p>I have an express app, that uses Firebase to store data. I am able to login, register and log out trough a client side script, but my problem is: How do I check via express if a user is logged in, to be able to send a different page to the logged in users?</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>var firebase = require('firebase');
  // Initialize Firebase
  var config = {
   serviceAccount: "./Chat Application-ad4eaaee3fcc.json",
   databaseURL: "MY_DATABASE_URL"
  };
  firebase.initializeApp(config);
  </code></pre>
  
  <p>and then I want to show a special page for logged in users, and this is what I have tried:</p>
  
  <pre><code>router.get("/special-page", function(req, res, next) {
      var user = firebase.auth().currentUser;
      console.log(user); // this variable gets undefined
      if(user) {
          res.render("special-page");
      } else {
          res.redirect("/");
    }
  });
  </code></pre>
  
  <p>I know this might seem like an easy question, but any help would be much appreciated!</p>
  
  <p>Thanks in advance.</p>