How to pass user sessionToken in cloud code?

I’m trying to save a parseObject in cloud code. I have to use session token and master key together.
This is what I have tried so far:

.save(null,{sessionToken: user.getSessionToken(),useMasterKey:true});

But session token doesn’t work. How to pass session token?

Edit: If I use only session token like this:

.save(null,{sessionToken: user.getSessionToken()});

It works, but passing both session token and master key will not work. Master key is working but seems like sessionToken value is ignored.

It looks like this could be related to an existing issue…

It doesn’t make sense to save an object passing session token and master key at the same time. You need to choose if you either you want to save the object as an user (by passing the session token) or the master (by passing the master key).

yes. I have that issue. I write a simple use case. to that issue. With my example code, Issue is reproducable

Hi Davi. I wrote a simple use case to the issue. See my codes. Even I use master key, I still need user id in my beforeSave trigger

Again it does not make sense. You need to choose if you want to do the operation as an user or as the master. What do you want to achieve by sending both session token and master key?

I’ll close this so we can keep discussion in one place: 6512.