diff --git a/README.md b/README.md index 3ff4a55..bdc7dbe 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,21 @@ It's a super light-weight AJAX wrapper for Parse.com's wonderful database servic # Why did you build it? I wanted a stupid-easy data store that I could use strictly from the client. No server needed! -One can simply write a thick front end application or app prototype and serve it from the file protocol -or through a Chrome extension. +Write a thick front end application or app prototype. -# Prototyping love. +# New! + +__Serve your app from http, cross domain calls FTW!__ +Parse launched support for __cross-origin__ resource sharing using CORS. +This means you no longer have to generate a base64 encoded Basic Auth key using the provided parse.sh +You can now just pass your application id and rest key right to `$.parse.init` and -Of course having your Parse.com authentication key sitting in your JS code is sort of a no-no. -However, for writing applications where you are focusing your effort first on the front end this is a great tool. + $.parse.init({ + app_id : undefined, // <-- enter your Application Id here + rest_key : undefined // <--enter your REST API Key here + }); + +# Prototyping love. * No Schema! Just fire a $.parse.post & forget it. If the collection hasn't been created already it will be instantiated. @@ -21,4 +29,3 @@ instantiated. # More to come.... * Backbone / Spine sync extension -* Working on one for MongoHQ diff --git a/demo/demo.js b/demo/demo.js index 2fc1040..a52683d 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -6,9 +6,8 @@ $.parse.init({ - //Enter a base64 Basic Auth string here.. - // (Easiest way to get this is by running parse.sh and grabbing the auth output) - auth : undefined // <--- your basic auth key goes here! + app_id : undefined, // <-- enter your Application Id here + rest_key : undefined // <--enter your REST API Key here }); function init(){ diff --git a/jquery.parse.js b/jquery.parse.js index 25047b4..3377e74 100644 --- a/jquery.parse.js +++ b/jquery.parse.js @@ -18,11 +18,14 @@ function _creds(){ var error; - if(_opts.auth){ + if(_opts.app_id && _opts.rest_key){ return true; } - error = "Missing auth key. You should pass your basic Auth key to $."+ns+".init"; + error = "Missing app_id, or rest_key authentication parameters.\n"+ + "Pass these credentials to $."+ns+".init\n"+ + "app_id = Application Id\n"+ + "rest_key = REST API Key"; alert(error); $.error(error); @@ -52,14 +55,10 @@ type : method, //Credentials - // -Note last I checked Stripe doesn't recognize Basic Auth sent through the URL scheme - username : _opts.app_id, - password : _opts.master_key, - - //Have to manually set a basic auth header. See above. - //Use Parse.sh result to C&P your basic auth and pass in $.parse.init + //NEW! Parse.com now supports CORS...https://parse.com/docs/rest headers : { - Authorization: "Basic " + _opts.auth + "X-Parse-Application-Id" : _opts.app_id, + "X-Parse-REST-API-Key" : _opts.rest_key }, error : _error }; diff --git a/parse.sh b/parse.sh index d5f597d..d496381 100644 --- a/parse.sh +++ b/parse.sh @@ -2,6 +2,7 @@ # Run this to get your base64 encoded Basic Auth header. # Get your credentials at https://www.parse.com/apps/{your app} +# NEW! You don't need to use Basic auth now! Parse.com now supports CORS...https://parse.com/docs/rest export APPLICATION_ID="" export MASTER_KEY=""