Hello,
It’s possible to update user by id in moralis (not user connected) ?!
Hello,
It’s possible to update user by id in moralis (not user connected) ?!
I think that you can do that only if you use master key, you can do that in a cloud function.
I already used this func but is not working
Moralis.Cloud.define(“updateUserById”, async (request) => {
const query = new Moralis.Query(“User”);
query.equalTo(“objectId”, request.params.selectedUser);
const user = await query.find({ useMasterKey: true });
user.set(“role”, request.params.role);
const result= await user.save()
return result;
});
There is a syntax for save that uses master key, you can find the syntax in documentation