How can i assign a role to a user

PLEASE can someone help me fix this problem, I have been trying to assign a specific role to users with this code but it is not working? if anyone has a better way of doing this please help me out

const roleInDB = new Moralis.Query(Moralis.Role);
roleInDB.equalTo(“name”, role);
const result = await roleInDB.first();

possible role values: collector,promoter,advisor

you may need to use master key, you will find example on another similar thread on how to read from Role table

can you please reply with the thread your talking about

I’ll also have to search It now on forum, did you try a search on forum?

yes i did. but i didn’t really get what i was looking for

did the above forum threads help you?

yet to implement them. if any of them work help me, i will update you