跟随这些链接https://firebase.google.com/docs/auth/web/manage-users#update_a_users_profilehttps://firebase.google.com/docs/auth/web/manage-users#get_a_users_provider-specific_profile_information

我能够对用户进行身份验证并使用其Twitter帐户登录。但是,我想获取用户的screenName。我该怎么做?

我检查了一些网络请求,并看到了screenName属性。我检查了onAuthStateChanged,它返回了user属性,但没有screenName

最佳答案

请参阅Get a user's profile文档。 .displayName属性应该具有它。


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.
}

关于node.js - 如何从Firebase身份验证正确获取Twitter screenName?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51823032/

10-09 04:57