2
votes

Following these links https://firebase.google.com/docs/auth/web/manage-users#update_a_users_profile and https://firebase.google.com/docs/auth/web/manage-users#get_a_users_provider-specific_profile_information

I was able to authenticate user and log in with their twitter account. However, I want to get the screenName of an user. How will I do that?

I've checked some network request and I see the screenName attribute. I've checked onAuthStateChanged and it returns user attribute but without the screenName.

1

1 Answers

-3
votes

See Get a user's profile documentation. The .displayName property should have it.

var user = firebase.auth().currentUser; 
var name, email, photoUrl, uid, emailVerified;


if (user != null) {
  name = user.displayName;
  email = user.email;
  photoUrl = user.photoURL;
  emailVerified = user.emailVerified;
  uid = user.uid;  // The user's ID, unique to the Firebase project. Do NOT use
                   // this value to authenticate with your backend server, if
                   // you have one. Use User.getToken() instead.
}