遵循这些链接https://firebase.google.com/docs/auth/web/manage-users#update_a_users_profile和https://firebase.google.com/docs/auth/web/manage-users#get_a_users_provider-specific_profile_information
我能够验证用户身份并使用其Twitter帐户登录。但是,我想获取用户的screenName
。我该怎么办?
我已经检查了一些网络请求,并且看到了screenName
属性。我检查了onAuthStateChanged
,它返回了user
属性,但没有screenName
。
答案 0 :(得分:-1)
请参阅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. }