title: How to get just the first name when a user logs in using social media with firebase?
body: <p>Here is the code that I am using to get the details of the user when they log in using google, facebook or twitter. </p>
  
  <pre><code>firebase.auth().onAuthStateChanged(function(user) {
      if (user) {
          // User is signed in.
          var displayName = user.displayName;
          var email = user.email;
          var emailVerified = user.emailVerified;
          var photoURL = user.photoURL;
          var uid = user.uid;
          var phoneNumber = user.phoneNumber;
          var providerData = user.providerData;
          user.getToken().then(function(accessToken) {
  
              console.debug('user', user);
  
              document.getElementById('name').textContent = displayName;
              document.getElementById("avatar").src = photoURL;
  
  
          });
  
      } else {
          console.log('not logged in');
  
      }
  
  });
  </code></pre>
  
  <p>Then in the html by writing <code>&lt;p id="name"&gt;&lt;/p&gt;</code> the entire name of the user is displayed. </p>
  
  <p>How do I display just the first name of the user?</p>