I try to check if a user exists with this function but it always returns undefined. What is wrong?
I want to know if a user exists to prevent my oauth integration from creating new accounts on each login.
Parse.Cloud.define("userExists", async (req) => {
const { email } = req.params;
return await new Parse.Query(Parse.User)
.equalTo("email", email)
.exists("authData")
.first({ useMasterKey: true });
});
And this is how I call it
const { email, id, id_token, access_token } = authData;
const exists = await Parse.Cloud.run("userExists", { email });
I’m aware that querying by email is disabled outside cloud environment. That’s why I created a cloud function for that purpose and use masterKey in it. But why isn’t it working?