I have a node.js express application using the Parse Javascript SDK and Parse-Server.
I installed everything according to the guide , but the JS SDK does not work.
I get it {error:unauthorized}. I can access my server using the REST API just fine, but not from the application using the JS SDK.
I read that you must specify useMasterKey = truefor all operations with Parse-Server so that:
var User = Parse.Object.extend('_User');
var query = new Parse.Query(User);
query.useMasterKey = true;
query.find().then( function(results) {
console.log(results);
},
function(error) {
console.log(JSON.stringify(error));
});
Should return the same data as this curl (right?):
curl -X GET \
-H "X-Parse-Application-Id: myAppId" \
-H "X-Parse-Master-Key: myMasterKey" \
http://localhost:1337/parse/classes/_User
Alas, this is not so.
The same error message when I try to run the default cloud code function:
Parse.Cloud.run('hello').then( function(response) {
console.log(response);
},
function(error) {
console.log(JSON.stringify(error));
});
Any ideas that might help? Thank.