Firebase NodeJS Authentication

帅比萌擦擦* 提交于 2019-12-10 00:48:01

问题


I have built a fairly basic ExpressJS app and am using Firebase for authentication. When the app loads it checks to see if a user is logged in and if not shows the login screen. The user then enters an email and password and this does a POST to my express ass and logs in the user like so:

app.post('/login-user', function(req, res) {
 firebase.auth().signInWithEmailAndPassword(req.body.email1, req.body.password1).then(function(authData){
   res.redirect('/')
 }).catch(function(error) {
   console.log('mainError', error)
   console.log('error', error.code);
   console.log('message', error.message);
 });
});

This works absolutely fine and the user is logged in and i can access their AuthData.

The issue is this logs the whole app into firebase. If I access the app on another computer it automatically logs in with this user. So basically, only one user can be logged in at one time.

What could I be doing wrong?

来源:https://stackoverflow.com/questions/40749038/firebase-nodejs-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!