I have a node.js express app using the Parse Javascript SDK and Parse-Server.
I've set everything up according to the guide but the JS SDK is not working.
I'm getting {error:unauthorized}. I can access my server with REST API just fine but not from within the app using the JS SDK.
I read that you have to specify useMasterKey = true for all operations with Parse-Server so:
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 that this curl does (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 the case.
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? Thanks.
{error:unauthorized}when trying to access the url the Parse Server is located "baseURL/parse". Also, when using the javascript SDK within the express app setting up the Parse Server, the Cloud Code functions always return an error. Has anybody been able to get Parse Server and the Parse JS SDK running from an Express app?Parse.initializelines altogether (because the server does that) and I don't have to use the masterkey in my queries or cloud code. Everything just works.