I have the following code that does not execute (I get back 500 internal server error).
What did I do wrong?
app.post('/api/sign-in', function (req, res, next) {
//auth
firebase.auth().signInWithEmailAndPassword(req.query.username, req.query.password)
//get back promise, log user object's email address
.then(function (user) {
console.log(user.email)
})
//log error
.catch(function (error) {
console.log(error);
})
});
I suppose as you are using a post request then you have to use req.body instead:
req.body.username, req.body.password