[英]How to handle Auth variable mechanism while using firebase Nodejs client
I am using Firebase Node.js client and every function is inside Node.js index.js
file.我正在使用 Firebase Node.js 客户端,每个 function 都在
index.js
内。
My user function firebase.auth().signInWithEmailAndPassword(email, password)
is also inside index.js
file of Node.js.我的用户 function
firebase.auth().signInWithEmailAndPassword(email, password)
也在 Node.js 的index.js
文件中。
If I am authenticating first user and then second and then third and so on, then I am not able to persist the auth variable for users as it is overwriting with one another.如果我正在验证第一个用户,然后是第二个用户,然后是第三个用户,以此类推,那么我无法为用户保留 auth 变量,因为它正在相互覆盖。
I went through the Firebase docs they are using client side JavaScript authentication codes but I do not want to use client visible codes as I have to write the other database transaction codes inside JavaScript itself if I use JavaScript authentication. I went through the Firebase docs they are using client side JavaScript authentication codes but I do not want to use client visible codes as I have to write the other database transaction codes inside JavaScript itself if I use JavaScript authentication.
I want to do authentication through Node.js itself and then allow persist the auth variable to use for security rules.我想通过 Node.js 本身进行身份验证,然后允许持久化 auth 变量以用于安全规则。
Appreciate your help.感谢你的帮助。 I am trying since three weeks but it is not happening for me.
我从三周开始就一直在尝试,但这对我来说并没有发生。
You are using a client side library and it seems like you are misunderstanding how the Firebase Authentication works.您正在使用客户端库,似乎您误解了 Firebase 身份验证的工作原理。 The authentication backend is handled by Firebase itself and you have nothing that needs to be done on your side, except using their Client libraries depending on what platform you are.
身份验证后端由 Firebase 本身处理,除了根据您所在的平台使用他们的客户端库外,您无需做任何事情。
One of the key benefit of using Firebase Auth is not to have to handle the user auth in the backend by yourself, and I strongly suggest you to read the documentation again: https://firebase.google.com/docs/auth使用 Firebase 身份验证的主要好处之一是不必自己在后端处理用户身份验证,我强烈建议您再次阅读文档: https://firebase.google.com/docs/auth
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.