title: How to change display name in firebase cloud functions?
body: <p>I am trying to build a firebase cloud function to change a display name.</p>
  <p>I know that i can do it easily in android, but since every time i change the display name i need to update all user records and since there isn't seem to be a way to get notified in firebase function when display name has changed (please correct me if i am wrong), i am planning to make the change in firebase and on the same time make the records update.</p>
  <p>This is how i started...</p>
  <pre><code>exports.changeDisplayName = functions.https.onCall((data,context) =&gt; {
  console.log(`User ${context.auth.uid} has requested to change its display name`);
  
  //If user not authenitacted, throw an error
  if (!(context.auth &amp;&amp; context.auth.token &amp;&amp; (context.auth.token.firebase.sign_in_provider === 'phone'))) {
      
      if (!context.auth) {
          console.log(`User ${context.auth.uid} without auth`);
      }
  
      if (!context.auth.token) {
          console.log(`User ${context.auth.uid} without token`);
      }
  
      if (!context.auth.token.phoneNumber) {
          console.log(`User ${context.auth.uid} without phone number (${context.auth.token.firebase.sign_in_provider})`);
      }
  
      throw new functions.https.HttpsError(
          'permission-denied',
          'Must be an authenticated user with cellphone to change display name'
        );
  }
  
  // Change display display name from data
  
  // update firebase contacts
  
  });
  </code></pre>