Parse User undefined cloud code

I try to get the current user how did the request using cloud function but I get user undefined
I try using the SDK and dashboard and get the same result

Parse.Cloud.beforeFind(“UserProfile”, async (req) => {
const user = req.user
if (!user) throw ‘Not Authorized’

below curl form dashboard
curl -X GET
-H “X-Parse-Application-Id: ddc9ac052450367e4a03c4056c21bff8”
-H “X-Parse-Master-Key: b59551ab147d580a84272044b2139fbd”
-H “X-Parse-Session-Token: r:91672efdf6d727a91d0235a26b8ca084”

It is happening because you are sending the X-Parse-Master-Key header which is making your cloud code function to run as a master (and not as a user). Send a client key instead (if your app requires one) and you should be fine.

1 Like