【问题标题】:Passing email address in custom token在自定义令牌中传递电子邮件地址
【发布时间】:2017-08-02 19:46:28
【问题描述】:

我有一个简单的后端,可以注册用户并使用 firebase-admin 包生成 jwt。

当我在 firebase 控制台 -> 身份验证中使用此自定义令牌登录时,未设置电子邮件地址。有没有办法从那里看到电子邮件地址?

【问题讨论】:

  • 你能展示你的新方法吗?我真的需要它

标签: firebase firebase-authentication jwt firebase-console firebase-admin


【解决方案1】:

您可以使用updateUser() 方法更新用户的电子邮件地址(详细文档here):

admin.auth().updateUser(uid, {
  email: "modifiedUser@example.com"
})
  .then(function(userRecord) {
    // See the UserRecord reference doc for the contents of userRecord.
    console.log("Successfully updated user", userRecord.toJSON());
  })
  .catch(function(error) {
    console.log("Error updating user:", error);
  });

【讨论】:

  • 这可能是正确的答案,但我没有测试它,因为我现在正在尝试一种新方法
  • 嘿@stulleman,我和你有同样的问题,即将使用jwngr的解决方案,但很好奇;你的新方法是什么?
猜你喜欢
  • 2014-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-19
  • 1970-01-01
相关资源
最近更新 更多