Xi *_*iao 3 firebase firebase-authentication firebase-realtime-database
我users在 Firebase 中有一个节点,用于存储每个用户的信息,但不包括 displayName andfirebase auth 数据库中的 email`。
有一天,我意识到我也需要用户displayName和email信息。例如,在另一个用户创建的页面中,我想显示该用户的 displayName 和电子邮件。
鉴于
displayName并且email不存储在users节点下, 是否可以从 firebase auth 数据库(普通用户或管理员)检索用户的displayName和email?或者我应该为已经在 firebase 中创建的用户做什么?
感谢:D
有了 AdminSDK,就可以像这里解释的那样。
在文档中有每种方法的示例,但在你的情况下,我猜你搜索了这个
admin.auth().getUser(uid)
.then(function(userRecord) {
// See the UserRecord reference doc for the contents of userRecord.
console.log("Successfully fetched user data:", userRecord.toJSON());
})
.catch(function(error) {
console.log("Error fetching user data:", error);
});
Run Code Online (Sandbox Code Playgroud)
你可以做类似的事情userRecord.displayName。完整的界面在这里。
| 归档时间: |
|
| 查看次数: |
1550 次 |
| 最近记录: |