Firebase - no displayName for user

前端 未结 2 773
野的像风
野的像风 2021-02-15 12:24

I can add users in Firebase console -> Auth but I can\'t do anything more than setting an email and password for them.

Could I in some way set for them displayName?

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-15 13:13

    I guess if you just want to update users profile:

    firebase.auth().onAuthStateChanged(function(user) {
      if (user) {
        // User is signed in.
        user.updateProfile({
            displayName: "Random Name"
        }).then(function() {
            // Update successful.
        }, function(error) {
            // An error happened.
        });
    
      } else {
        // No user is signed in.
      }
    });
    

    Additionally: https://firebase.google.com/docs/auth/web/manage-users

提交回复
热议问题