简体   繁体   English

使用 firebase Nodejs 客户端时如何处理 Auth 变量机制

[英]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.

相关问题 如何知道用户是否在 Nodejs 上使用 Firebase 通过 Google auth 进行了身份验证? - How to know if user is authenticated with Google auth using Firebase on Nodejs? 使用NodeJS进行Firebase身份验证:获取发出请求的客户端的UID - Firebase auth with NodeJS: getting the UID of the client making the requests Firebase Auth SignOut() - nodejs - Firebase Auth SignOut() - nodejs NodeJs 和 React 与 Firebase 身份验证:如何保护 nodejs api 端点? - NodeJs and React with Firebase auth: how to secure nodejs api endpoints? 如何在不在客户端上安装Firebase SDK的情况下使用Firebase Auth创建安全API - How to create a secure API using Firebase Auth without installing Firebase SDK on the client 如何在客户端nodejs处理异步请求? - How to handle async request at client nodejs? Firebase处理Node.js中的事务 - Firebase handle transactions in Nodejs 如何保护 firebase NodeJS 上的客户端 -> 后端 - How to secure client -> backend on firebase NodeJS 如何编写一个nodejs代码,以处理android和nodejs客户端? - How to write a nodejs code, to handle android and nodejs client? 使用 firebase auth 认证谷歌云大查询库 - NodeJS - Using firebase auth to authenticate google cloud bigquery library - NodeJS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM