Reputation: 6007
I'm guessing you have to do something with re authing to remove the phone number because at the moment I am trying to do this:
const user = firebase.auth().currentUser;
user.updateProfile({phoneNumber: null}).then(() => { alert('success') }).catch(err => {alert(err)})
this is not working, but I am getting the success block
Upvotes: 6
Views: 5093
Reputation: 2190
In case anyone is looking for an answer to this question from an Admin SDK perspective, you just set the phoneNumber field on the UserRecord to null.
admin.auth().updateUser( user.uid, { phoneNumber: null } )
Upvotes: 2
Reputation: 30838
To remove a phone number account from a user, simply unlink it:
firebase.auth().currentUser.unlink(firebase.auth.PhoneAuthProvider.PROVIDER_ID);
Upvotes: 11
Reputation: 11326
As stated on the documentation:
You can update a user's basic profile information—the user's display name and profile photo URL—with the updateProfile method.
This means you can only update the user's display name and profile photo. There's also the updateEmail
method which can be used to update the user's email. But there's no way to update the phone.
Upvotes: 0