What header do I need to use the javascript key

384 views Asked by At

What header do I need to use the javascript key

I've been using

xmlhttp.setRequestHeader('X-Parse-Application-Id', 'j4CT1qeW9wI1AvNcu7HGhwm08vQTFGnf3scYgSI3');
xmlhttp.setRequestHeader('X-Parse-REST-API-Key', 'E9DMy4x4LAqdIinhNDPIXQn90naWL80jc4rTsk0t');
1

There are 1 answers

4
papergodzilla On

You will want to set the application id and javascript key for general parse js. Those keys are set like this, however: https://www.parse.com/apps/quickstart#parse_data/web/existing

If you are doing a REST API request as you are showing, then you use the keys you showed. You can find the values if you go to the parse web interface, go to your app, go to settings, then on the left click "Keys".

Assuming you are using the correct key values, you are setting the header for that request correctly. What is going wrong with your request?

Edit:

If you want to make a REST API call without exposing your REST key, write a cloud code function that makes the REST call for them. That way they call the cloud function using the javascript key, and the cloud function calls REST with the REST API key (but the user won't see it). Then the REST call returns data to the cloud function, and the cloud function returns the data to the client through the response.