ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

Request with npm package #120

Open rafa-acioly opened 7 years ago

rafa-acioly commented 7 years ago

I'm trying to use the npm package "woocommerce-api" a few days ago and am having a problem where the "signature" of the request is invalid.

I first thought that ember was changing the key before making the request, but then a friend informed me that browserify is who handles this package because it is imported using "npm: woocommerce-api".

I tested the package in several frameworks like vue, react, electron and etc, and even using postman, and it works perfectly. It just does not work when I try to use ember.

I have already checked and compared the generator request parameters for the chrome and postman "network" tab, and both look the same except for the "signature" and some other parameters that are changed in all requests such as timestamp.

Nothing seems very different but I still get the "invalid signature" error of the npm package

The Postman Request

postman

The chrome network tab

chrome

Nothing seems very different but I still get the "invalid signature" error in the npm package.

  1. The Woocommerce Package
  2. A example of usage
ef4 commented 7 years ago

Nothing in ember-browserify is likely to interfere with the way this library signs its requests. My first guess is that there's a bug somewhere in your app that's causing you to get different keys than you think you're getting.

That said, I think you should check with the authors of the woocommerce-api package to see if they really intend it to run in the browser. It's authored for node and it handles authentication data, so you may be violating their security assumptions and opening your app up to vulnerabilities.