FirebaseNodeJS:函数

编程入门 行业动态 更新时间:2024-10-03 10:45:57

FirebaseNodeJS:<a href=https://www.elefans.com/category/jswz/34/1771370.html style=函数"/>

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,
})

更多推荐

FirebaseNodeJS:函数

本文发布于:2024-05-30 17:21:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1770740.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   FirebaseNodeJS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!