Description
So, im a bit frustrated right now due to the fact that I'm trying to get data out of the parse server via either PHP or JS and I wanted to make sure I wasn't doing something wrong or missing something.
First Im running parse server on Heroku with MongoLab and I have confirmed that its working via CURL command to pull the same data I'm trying to with JS or PHP.
Here is my CURL command that returns results I'm looking for.
curl -X GET \
-H "X-Parse-Application-Id: xxxxxxxxx" \
-H "X-Parse-REST-API-Key: xxxxxxxxx" \
-H "X-Parse-Master-Key: xxxxxxxxx" \
-G \
--data-urlencode 'where={"gamelID":"afcd60f2-f9b2-4c5f-9148-1de46713552b"}' \
https://xxxxxx.herokuapp.com/parse/classes/UserTag
Yesterday I tried to get the same data returned from CURL via PHP w/o any luck see #124
Today I wanted to see if I could get it working with a simple JS query see code below.
<!doctype html>
<head>
<meta charset="utf-8">
<title>My Parse App</title>
<meta name="description" content="My Parse App">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/styles.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-latest.js"></script>
</head>
<body>
<div id="main"></div>
<script type="text/javascript">
Parse.initialize("xxxxxx", "xxxxxx");
Parse.serverURL = 'https://xxxx.herokuapp.com/parse'
var UserTag = Parse.Object.extend("UserTag");
var query = new Parse.Query(UserTag);
query.equalTo("gameID", "afcd60f2-f9b2-4c5f-9148-1de46713552b");
query.find({
success: function(results) {
console.log("Successfully retrieved " + results.length + " scores.");
// Do something with the returned Parse.Object values
for (var i = 0; i < results.length; i++) {
var object = results[i];
console.log(object.id + ' - ' + object.get('placeName'));
}
},
error: function(error) {
console.log("Error: " + error.code + " " + error.message);
}
})
</script>
</body>
</html>
In the console log im getting a 403
I have verbose enabled but the Heroku logs really dont tell me much
2016-02-11T00:07:36.599825+00:00 heroku[router]: at=info method=POST path="/parse/classes/UserTag" host=xxxx.herokuapp.com request_id=b6c443c9-0a33-4e08-b309-4add49b9be18 fwd="12.215.39.106" dyno=web.1 connect=1ms service=17ms status=403 bytes=273
Anyone have any ideas..
I have double checked my keys, and again as stated above the CURL request works.
In the migration docs it states for using the JS SKD use this code
Parse.initialize("YOUR_APP_ID", "YOUR_APP_CLIENT_KEY");
Parse.serverURL = 'http://localhost:1337/parse'
Any thoughts? If its a silly mistake on my part I'm sure im not the only one running into it so any debugging would be appreciated.