This was asked here but without a clear answer on how to get the current installation from the cloud.
In my cloud function, I need to bind the current user with the current installation, I can send the current user within the request object to the cloud function, but I cannot find any way to get the current installation within the cloud code. I know this is pretty easy in iOS SDK but since I am using javascript, I need a way to access the current installation from the cloud code. How is that be doable?
You can get the installationId from your current session.
Parse.Session.current()
.then(function(session) {
// Get the installation ID
installationId = session.get('installationId');
});
edit: JavaScript doesn't have installations, so what installation are you trying to alter?
The answer is going to be the same here.. The "installation" isn't sent with every request like the user is, so you need to assign that relationship elsewhere. Either you send in the current installation object id with your function request, or you save a pointer (either way) to pair the user and the installation together and then query for the related object in cloud code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With