I would like to find a user by their phone number and update their displayName
in Firebase Cloud Functions using the Admin SDK.
When I try to run this code for example:
import * as admin from 'firebase-admin'
admin.auth().getUserByPhoneNumber(phone).then((user) => {
user.displayName = newName;
}).catch((reason) => console.log(reason['message']));
I get the following message:
Cannot assign to read only property 'displayName' of object '#UserRecord'
Although I undestand this exception, I cannot think of a diffrent way to do this. Any idea?