I have been struggling with this issue for a while. This is part of a more complex system that I did not create. SignUp works, however, logIn does not. I stripped it down to a simpler approach to minimize possible problems while troubleshooting.
This is what is inside my controllers/login.js file
const signinAuth = (Parse) => async (req, res) => {
var user = new Parse.User();
user.set("username", "[email protected]");
user.set("password", "password01");
//This part I used to test signUp in the simplest way possible. IT WORKS and can see it in dashboard.
/*
user.signUp().then(function success(user) {
console.log("Signed up ", user);
}, function error(err) {
console.error(err);
})*/
try {
const user = await Parse.User.logIn("[email protected]", "password01");
console.log(Parse.User.current());
res.status(200).json({ message: 'Login successful', user: user });
} catch (error) {
console.error('Error during login:', error);
res.status(500).json({ error: 'Login failed', details: error.message });
}
};
The error I am given is the following:
Error during login: ParseError: Received an error with invalid JSON from Parse: Cannot POST /parse/login
at handleError (D:path\WebPage\node_modules\parse\lib\node\RESTController.js:301:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async D:path\WebPage\controllers\login.js:102:20 {
code: 107
}