简体   繁体   中英

How do I add name and email to a Firebase user account during signup with phone number?

In the Firebase docs it describes how to create an account using phone number sign up .

When signed in, Firebase returns a user object that looks like this:

在此处输入图像描述

However nowhere in the above docs does it describe how to add information like email and displayName during sign up.

How do I add this information to a profile during the user signup using phone number authentication?

The API provides no way of providing additional information at the moment an account is first created. However, there are links at the bottom of that page that send you to information about how to manage users after that. In particular, you will want to read the section on updating a user's profile and setting a user's email address . From the documentation:

user.updateProfile({
  displayName: "Jane Q. User",
  photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(function() {
  // Update successful.
}).catch(function(error) {
  // An error happened.
});

And:

user.updateEmail("user@example.com").then(function() {
  // Update successful.
}).catch(function(error) {
  // An error happened.
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM