Repository navigation
Cant get data via JS or PHP from Parse Server #352
Description
Activity
The JavaScript SDK uses javascriptKey. The parse-server-example doesn't set it on init. You have to modify your index.js file:
https://github.com/ParsePlatform/parse-server-example/blob/master/index.js#L13-L17
var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_COD javascriptKey: process.env.CLIENT_KEY || 'javascriptKey',
Shouldn't parse-server-example simply init it for backwards compatibility?
Also, I was able to get stuff to work with master Key but it becomes something like the following (for some reason I have to set useMasterKey on the actual save as well):
Parse.initialize("myAppId", "javascriptKey"); Parse.masterKey = "abc"; Parse._useMasterKey = true; var testObject = new TestObject(); testObject.save({ foo: "bar", success: function (object) { $(".success").show(); }, error: function (model, error) { $(".error").show(); } }); {useMasterKey: true});
This could be a keys issue. The best troubleshooting step here is not to set any client keys. No rest/js/client/dotnet... Only master key should be defined. Unauthorized means either you've hit the wrong server, or you're using the wrong appid/keys, or you've set at least 1 client key but not the one you're calling with (i.e. you set the rest key, and now get fails on JS).
@gfosco - it is definitely a keys issue, has the Parse JavaScript SDK been updated though to make things more streamlined to work with the master key? See comment above.
- addedtype:questionSupport or code-level questionSupport or code-level questionand removed
on Jul 11, 2021
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.
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.
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=273Anyone 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
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.