title: Uncaught TypeError: Cannot read property 'uid' of null using website
body: <p>I want to get registered user details from firestore into html page. When user clicks my profile page it navigate to next html page with fields like first name and last name etc.. . This fields are already entered at the time of signup page. so i want get those details from firestore into next html page. But i  got the error like  "Cannot read property 'uid' of null ".  How to resolve that problem this is my html page :</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;title&gt; deyaPay&lt;/title&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
           &lt;script src="https://www.gstatic.com/firebasejs/4.6.2/firebase-app.js"&gt;&lt;/script&gt;
           &lt;script src="https://www.gstatic.com/firebasejs/4.6.2/firebase-auth.js"&gt;&lt;/script&gt;
          &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://www.gstatic.com/firebasejs/4.6.2/firebase-firestore.js"&gt;&lt;/script&gt;
           &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"&gt;
           &lt;script&gt;
            var config = {
      apiKey: "AIzaSyAJsAstiMsrB2QGJyoqiTELw0vsWFVVahw",
      authDomain: "websignin-79fec.firebaseapp.com",
      databaseURL: "https://websignin-79fec.firebaseio.com",
      projectId: "websignin-79fec",
      storageBucket: "",
      messagingSenderId: "480214472501"
    };
     firebase.initializeApp(config);
     &lt;/script&gt;
     &lt;script src="https://www.gstatic.com/firebasejs/4.6.2/firebase-firestore.js"&gt;&lt;/script&gt;
           &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous"&gt;
     &lt;style&gt;
     // css goes here..
     &lt;/style&gt; 
     &lt;script type="text/javascript"&gt;
        function myProfile() {
            var user = firebase.auth().currentUser.uid;
            var db = firebase.firestore();
            var docRef = db.collection("deyaPayusers").doc(user);
            docRef.get().then(function(doc) {
               if(doc &amp;&amp; doc.exists) {
               const myData = doc.data();
               const ffname = myData.FirstName;
               const llname = myData.LastName;
               const phonen = myData.PhoneNumber;
               document.getElementById("fname").value = ffname;
               document.getElementById("lname").value = llname;
               document.getElementById("phone").value = phonen;
  
          }
          }).catch(function(error) {
          console.log("Got an error: ",error);
          });
        }  
  
      &lt;/script&gt;
     &lt;/head&gt;
     &lt;body onload='myProfile()'&gt;
        &lt;div class= "login-form"&gt;
            &lt;form method="post"&gt;
               &lt;h2&gt;Profile&lt;/h2&gt;
                &lt;div class="form-group"&gt;
                    &lt;input type="text" name="firstname" id="fnmae" placeholder="FirstName" class="form-control" &gt;
                &lt;/div&gt;
                 &lt;div class="form-group"&gt;
                    &lt;input type="text" name="lastname" id="lnmae" placeholder="LastName" class="form-control" &gt;
                &lt;/div&gt;
                &lt;div class="form-group"&gt;
                   &lt;input type="text" name="phone" id="phone" placeholder="PhoneNumber" class="form-control" &gt;
                &lt;/div&gt;
  
            &lt;/form&gt;
        &lt;/div&gt;
  
     &lt;/body&gt;
   &lt;/html&gt;                
  </code></pre>