最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

FirebaseNodeJS:函数

网站源码admin54浏览0评论

FirebaseNodeJS:函数

FirebaseNodeJS:函数

我正在尝试根据我的函数文件中的电子邮件地址获取用户的 uid:

admin.auth().getUserByEmail("[email protected]")
        .then(function(userRecord) {
          response.json({
            uid: userRecord.getUid(),
          })
        console.log("Successfully fetched user data:", userRecord.toJSON());

但是在我的函数日志中 -

Error fetching user data: TypeError: userRecord.getUid is not a function

我的 console.log 对 userRecord.toJSON 没问题,但我正在尝试将 uid 返回到前端。有什么建议么?我错过了什么,因为这应该有效吗?

回答如下:

您必须使用

uid
UserRecord属性。

response.json({
  uid: userRecord.uid,
})

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论