简体   繁体   English

我想从 react 和 firebase 创建一个用户注册

[英]I want to create a user registration from react and firebase

Im working in a project and im using react and firebase for that.我在一个项目中工作,我为此使用了 react 和 firebase。 I want to create a user registration, I can use firebase authentication with google or facebook.我想创建一个用户注册,我可以使用 firebase 身份验证与 google 或 facebook。 but thats not what I want.但这不是我想要的。 I want to take many data from the user and let that data appear on their profile.我想从用户那里获取许多数据,并让这些数据出现在他们的个人资料中。 so can I do that with react and firebase.所以我可以用 react 和 firebase 做到这一点。 ? ? can we use firebase as a database to store users data?我们可以使用 firebase 作为数据库来存储用户数据吗?

An user have an UID (unique id) when he logs in to your app.用户在登录您的应用程序时拥有一个 UID(唯一 ID)。 You can store the uid in the database and then link other infos to it.您可以将 uid 存储在数据库中,然后将其他信息链接到它。 You can get it with firebase.auth().currentUser.uid您可以使用firebase.auth().currentUser.uid获得它

Take a look atthe official documentation看看官方文档

What I usually do is creating a "profiles" collection.我通常做的是创建一个“配置文件”集合。 A profile document's ID is the User ID and contains more data ie email.配置文件的 ID 是用户 ID,包含更多数据,即 email。 I create the profile document after the firebase auth register function is done and I have the register user object.我在 firebase 身份验证寄存器 function 完成后创建配置文件文档,并且我有注册用户 object。

You can also put that logic in a cloud function if you need security.如果您需要安全性,您还可以将该逻辑放在云 function 中。

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

相关问题 如何从 react 和 firebase 为每个用户创建用户页面 - How to create user page for each user from react and firebase 想要在 firebase 中的文档中创建一个子集合,当用户注册到应用程序时反应原生它的子集合创建 - want to create a subcollection in document in firebase when user sign up to app in react native its children subcollection created 我想检查用户是否使用 firebase 登录 - I want to check if a user is signed in with firebase 如何批准使用Firebase的用户注册? - How to approve user registration with Firebase? Firebase、用户注册和导航问题 - Firebase, user registration and navigation issue 使用React Redux注册用户后该怎么办? - What should I do after user registration with React Redux? 我想使用反应上下文状态管理从我的反应项目中的表单设置用户名,但它保持未定义 - I want to set the user name from a form in my react project with react context state management but it stays undefined 我想检查用户是否在 React 应用程序中在线? - I want to check if user is online in a React app? 即使在重新加载后,我也想在用户注册期间保留用户信息 - I want to keep the user information during user registration even after reloading 我想从 Firebase 获取文档数据 - I want to get doc data from Firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM