adelevie / parse-ruby-client

A simple Ruby client for the parse.com REST API
MIT License
415 stars 137 forks source link

client key shouldn't be required #209

Closed jlhonora closed 8 years ago

jlhonora commented 8 years ago

As per the parse server docs:

Parse Server does not require the use of client-side keys [...] The Application ID is sufficient to secure your app.

source

This library however raises an error when the client key is not specified. How can we work around this restriction?

Thanks in advance.

rhymes commented 8 years ago

@jlhonora The ruby does not require you to provide all the keys, you can initiate it with just the application ID or whatever combination you prefer.

[11] pry(main)> client = Parse.create(application_id: 'foobar') => #<Parse::Client:0x007f9009f53de0 @api_key=nil, @application_id="foobar", @backoff_factor=2, @host="https://api.parse.com", @interval=0.5, ...

[13] pry(main)> client.query('_Installation').get() I, [2016-06-30T17:39:42.196518 #84545] INFO -- : Parse query for /installations {"where"=>"{}"} I, [2016-06-30T17:39:42.197089 #84545] INFO -- : get https://api.parse.com/1/installations?where=%7B%7D I, [2016-06-30T17:39:42.690031 #84545] INFO -- Status: 401 Parse::ParseProtocolError: : unauthorized from /Users/rhymes/.rvm/gems/ruby-2.3.1/bundler/gems/parse-ruby-client-18c7f9952564/lib/faraday/extended_parse_json.rb:30:in `process_response'

As you can see I only get an error when I actually call the server. Do you have a traceback to provide?

jlhonora commented 8 years ago

@rhymes hmmm, can't seem to replicate it now, so I'm closing this.

In any case, the docs are a bit misleading in this part:

:api_key        => "<your_api_key>", # required

Anyways, thanks a lot for taking a look.

rhymes commented 8 years ago

@jlhonora I've updated the docs, thanks for the catch!

https://github.com/adelevie/parse-ruby-client/commit/9b79ec7dfb1726815636c9fa1b3429c57bf068fa