简体   繁体   English

同步Firebase身份验证数据

[英]Sync firebase auth data

When a create a new firebase auth user using facebook or google, I received the user email and name but when I create a anonymous user and convert it to a facebook user the name still empty. 当使用Facebook或Google创建新的Firebase身份验证用户时,我收到了用户的电子邮件和名称,但是当我创建匿名用户并将其转换为Facebook用户时,名称仍然为空。 How I to to sync the data from facebook or google in every new login? 如何在每次新登录时同步来自facebook或google的数据?

Thanks in advance. 提前致谢。

AskFirebase AskFirebase

Just use the updateProfile API. 只需使用updateProfile API。 Here is an example with web on how to update the display name to the one in the provider data (assuming Facebook): 这是一个网络示例,说明如何将显示名称更新为提供者数据中的显示名称(假设为Facebook):

firebase.auth().currentUser.updateProfile({
  displayName: firebase.auth().currentUser.providerData[0].displayName
}).then(function() {
  // Display name updated successfully.
}).catch(function(error) {
  // error occurred.
});

To learn more about this API, refer to the Firebase references . 要了解有关此API的更多信息,请参阅Firebase参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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