I'm trying to call a cloud function using cURL (or from Postman) for testing. The problem is, I need to somehow set a "current user" so I can use request.user
.
I've tried everything I can think of - setting it in the body of the request, using useMasterKey
, fetching a user from an objectId
and assigning it within the cloud code function etc. I've even tried making the request through a proxy to try see how it's done, so I could replicate it... I've got nothing.
Simply trying to save a new object to a class Orders
with a user
object...
In order to have a request.user in present in your cloud code, you will need to pass in a session token.
First query the session class.
curl -X GET \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
https://YOUR.PARSE-SERVER.HERE/parse/sessions
Then pick any user session token and add that to the header of your orginal request.
The header should be in this format
"X-Parse-Session-Token: your_session_token"
And it will work.