title: How to pass user uid from login page to a different page in a web app
body: <p>I'm logging in users via firebase-auth and need to pass their user uid to the redirected page. How can the user-uid be passed?</p>
  
  <p>I've tried using the docs on firebase auth but cant quite solve it</p>
  
  <pre><code>
  loginForm.addEventListener('submit', (e) =&gt; {
   e.preventDefault();
  
      const email = loginForm['email'].value;
      const password = loginForm['password'].value;
  
      console.log(email, password);
      firebase.initializeApp(config);
      firebase.auth().signInWithEmailAndPassword(email, password)
          .then(cred =&gt; {
  
  
          if(email ==='admin@mombasa.com' &amp;&amp; password ==='adminMomb') {
              window.location = './admin-map.php';
          }
              else if(email ==='admin@nairobi.com' &amp;&amp; password ==='adminNai') {
                  window.location = './admin-map.php';
              }
             else if(email ==='admin@eldoret.com' &amp;&amp; password ==='adminEld') {
                  window.location = './admin-map.php';
              }
  
  
             else firebase.auth().onAuthStateChanged(function(user) {
  
                      window.user = user;
                      console.log('logged in ', user);
                      window.location = './dailyreports.php';
                      console.log('logged in ', user);
  
              });
  
          }).catch(
          function(error) {
              // Handle Errors here.
              var errorCode = error.code;
              var errorMessage = error.message;
              // ...
              console.log(errorMessage, errorCode);
          }
      )
      ;
  
  
  });
  </code></pre>
  
  <p>On navigation to the next page, I expected to see the user-uid output in the console but it returns blank</p>