Closed choubacha closed 9 years ago
Ok, I'll test tomorrow
@claudiosmweb We're using my fork right now but wanted to ping to see if I could get eyes on this :smile:
@kbacha This does not work fine yet, Has nothing organized by alphabetical order, then we have problem with oAuth...
@claudiosmweb My understanding is that the ordering is only necessary for the signature of the oauth. So, it only needs to be ordered when doing http and generating the oauth URL to sign. This should still work (and does in our production environment) because the OAuth class will reorder the query params.
@kbacha test it.
@kbacha this is broken!
Test:
woocommerce.get("customers", { page: 2, filter: { role: "all", limit: 1 } })
Response:
{"errors"=>[{"code"=>"woocommerce_api_authentication_error", "message"=>"Invalid Signature - provided signature does not match"}]}
Because of the wrong order!
@claudiosmweb I believe this is a problem with the way the sort in the OAuth class is working, not the way i add query params:
2.2.2 :016 > r = client.get('products?page=2&filter[role]=all&filter[limit]=1') 2.2.2 :019 > JSON.parse(r.body) => {"errors"=>[{"code"=>"woocommerce_api_authentication_error", "message"=>"Invalid Signature - provided signature does not match"}]}
But I'll look into making it work correctly.
@claudiosmweb
I fixed the OAuth class so that it always sorts the params that are passed in. 17fc2d17126dbbc93dd86049f82519165fee480c
@kbacha Great now :) Thanks.
@claudiosmweb
This enables passing data into the get and delete routes (which would be needed for filters and forces) instead of using the query params as strings.
This:
rather than this:
For filters it's even more obvious why this form is better: