You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need master key perms to call request.user.fetch() in cloud code #750
This code works on legacy Parse without using the master key. On Parse Server I need to send {useMasterKey: true} to the fetch() call to make it work. Shouldn't cloud code assume the permissions of the user making the call?
Environment Setup
A user that looks like this is logged in to our iOS app:
The difference in the node environment is that there is no 'current' user. So, in order to make a query as a user, you need to pass in the users session token, or override security with the master key option. This may seem slightly counter-intuitive at first, but it is correct.
For sending push notification I am using Parse.push.send() , which requires a querry for fetching the Installations to which the notification will be sent, but there is no way to set the useMasterKey: true there, what can I do to overcome that ?
You need to pass {useMasterKey: true} in the push send options, and it will find the correct installations. You don't need to fetch manually the installations, passing the query is enough. Additionally, you must pass the master key to the push send function.
It am passing userMasterKey: true, but still getting Error: unauthorized: master key is required, here is my code: var pushQuery = new Parse.Query(Parse.Installation); pushQuery.equalTo("deviceType", "ios"); pushQuery.equalTo("appVersion", 250); var pushData = {"title":"title test", "alert":"alert test"};
Activity
gfosco commentedon Mar 3, 2016
The difference in the node environment is that there is no 'current' user. So, in order to make a query as a user, you need to pass in the users session token, or override security with the master key option. This may seem slightly counter-intuitive at first, but it is correct.
sami4064 commentedon Feb 18, 2017
For sending push notification I am using Parse.push.send() , which requires a querry for fetching the Installations to which the notification will be sent, but there is no way to set the useMasterKey: true there, what can I do to overcome that ?
natanrolnik commentedon Feb 18, 2017
You need to pass
{useMasterKey: true}in the push send options, and it will find the correct installations. You don't need to fetch manually the installations, passing the query is enough. Additionally, you must pass the master key to the push send function.sami4064 commentedon Feb 18, 2017
It am passing userMasterKey: true, but still getting Error: unauthorized: master key is required, here is my code:
var pushQuery = new Parse.Query(Parse.Installation);pushQuery.equalTo("deviceType", "ios");pushQuery.equalTo("appVersion", 250);var pushData = {"title":"title test", "alert":"alert test"};