简体   繁体   English

如何从 Firebase 电子邮件身份验证中获取电子邮件的用户 ID

[英]How to get the user id of a email from firebase email authentication

I want to access the id (or uid ) of a email from firebase authentication .我想从 firebase authentication 访问电子邮件的 id (或 uid )。 Its not the id of current users id, so i cant use firebase.auth().currentUser.uid.它不是当前用户 ID 的 ID,所以我不能使用 firebase.auth().currentUser.uid。 and i am also not in a position to store the uid in the database at the time of sign up and fetch it.而且我也无法在注册时将 uid 存储在数据库中并获取它。 is the anyway to fetch it directly from firebase authentication system无论如何直接从firebase身份验证系统获取它

The Firebase Admin SDK supports looking up user information with an email: Firebase Admin SDK 支持通过电子邮件查找用户信息:

admin.auth().getUserByEmail(email)
  .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);
  });

This method returns a UserRecord object for the user corresponding to the email provided.此方法为与提供的电子邮件对应的用户返回一个 UserRecord 对象。

If the provided email does not belong to an existing user or the user cannot be fetched for any other reason, the Admin SDK throws an error.如果提供的电子邮件不属于现有用户或由于任何其他原因无法获取用户,则 Admin SDK 会引发错误。

Reference: https://firebase.google.com/docs/auth/admin/manage-users参考: https : //firebase.google.com/docs/auth/admin/manage-users

使用 admin.auth().getUserByEmail(email)

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

相关问题 如何在特定用户android的Firebase身份验证上更改电子邮件ID - How to change email id on Firebase Authentication of a particular user android 如何使用Firebase电子邮件/密码身份验证获取UID并添加用户信息 - How to get UID and add user information with Firebase email/password authentication 如何在Android中从Facebook获取用户电子邮件ID和用户名 - How to get user email id , user name from Facebook in android 如何通过用户电子邮件 Firebase android 获取用户 ID? - How to get userID by user Email Firebase android? 如何允许电子邮件ID在firebase中接收OTP以进行身份​​验证 - How to allow email id to receive OTP in firebase for authentication Firebase身份验证(电子邮件和密码)如何检查用户是否仍然存在? - Firebase Authentication (email and password) How to check if user still exists? 如何确定 Firebase 用户是否使用电子邮件和密码身份验证登录 - How to determine if a Firebase user is signed in using email and password authentication Firebase Authentication ( Email & Password ) 如何查看现有用户 - Firebase Authentication ( Email & Password ) how to check existing user 获取用户电子邮件Firebase身份验证 - Get the user email firebase auth 如何将自动生成的 firebase 节点 ID 替换为当前用户 email - How to replace autogenerated firebase node id to the current user email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM