Hi there, for the past few days I am trying to make login/logout with parse-server
I am starting from this parse server example: GitHub - parse-community/parse-server-example: Example of Parse Server using the express framework.
the onlything I did was put this line inside cloud/main.js
await import('./login.js');
the login route works, but I am unable to login
here is my login.js file
Parse.Cloud.define("login", async (req) => {
console.log("Username: " + req.params.username);
console.log("Password: " + req.params.password);
if (!req.params.username || req.params.username === "") {
throw "username not provided.";
}
if (!req.params.password || req.params.password === "") {
throw "password not provided.";
}
try {
const user = await Parse.User.logIn(req.params.username, req.params.password);
return user;
} catch (error) {
const errorMessages = {
101: "Something went wong, probably username does not exists.",
// Adicione mais traduções de mensagens de erro conforme necessário
};
const errorCode = error.code || 0;
const translatedError = errorMessages[errorCode] || "Error.";
throw new Parse.Error(errorCode, translatedError);
}
});
but I always get this back
{
"code": 101,
"error": "Invalid username/password."
}
I would exept at least to get username and passwrod inside my console, but nothing is printed exept the same error I get inside my postmane
My end goal is to make maself user login/register/logout with graphql like I talked here: Parse server login with protected /graphql route
but I am very slowly getting there