title: Firebase Auth store firstName and lastName of user
body: <p>Dear Stackoverflow community, </p>
  
  <p>We are using Firebase Auth for our authentication. For this we are offering social sign in with google and facebook as well as signing in with email and password. The following code shows the registration page for users that want to sign in with email and password later. </p>
  
  <pre><code>import { Router } from '@angular/router';
  import { Component, OnInit } from '@angular/core';
  import { AngularFireAuth } from '@angular/fire/auth';
  import { auth } from 'firebase/app';
  
  
  @Component({
    selector: 'app-register',
    templateUrl: './register.component.html',
    styleUrls: ['./register.component.css']
  })
  export class RegisterComponent implements OnInit {
    public emailAddress="";
    public firstName="";
    public lastName="";
    public password="";
  
    constructor(public afAuth: AngularFireAuth, private router: Router) {
    }
  
    ngOnInit() {
    }
  
    reset() {
      this.emailAddress=""
      this.password=""
      this.firstName=""
      this.lastName=""
    }
  
    register() {
      let emailAddress = this.emailAddress
      let password = this.password
      let firstName = this.firstName
      let lastName = this.lastName
      this.reset()
      console.log(emailAddress)
      console.log(password)
      auth().createUserWithEmailAndPassword(emailAddress, password).catch(function(error) {
        // Handle Errors here.
        var errorCode = error.code;
        console.log(errorCode)
        var errorMessage = error.message;
        console.log(errorMessage)
        // ...
      });
    }
  }
  </code></pre>
  
  <p>The data for email, password, firstName, lastName is coming from an input field that exchanges data via data binding with the component.</p>
  
  <pre><code>&lt;input type="email" [(ngModel)]="emailAddress" required&gt;
  </code></pre>
  
  <p>When I try to get the users display name its only working when the user signed in using the social provider. Thats kind of obvious because he didn't set it when registering with email and password. Now i wanted to ask you if someone knows how to store the firstName and lastName in firebase so the user.displayName can be shown.</p>
  
  <pre><code>&lt;div *ngIf="afAuth.user | async as user; else notAuth"&gt;
   Hello {{ user.displayName }}
  &lt;/div&gt;
  </code></pre>