Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the current installation within the cloud function

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?

like image 887
Malloc Avatar asked Aug 01 '26 05:08

Malloc


2 Answers

You can get the installationId from your current session.

Parse.Session.current()
  .then(function(session) {
    // Get the installation ID
    installationId = session.get('installationId');
  });
like image 199
Gaurav Butola Avatar answered Aug 02 '26 18:08

Gaurav Butola


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.

like image 45
Fosco Avatar answered Aug 02 '26 18:08

Fosco