Nodejs implementation - getting 401 - not sure why - full code inside

Posted in General by R F Wed Apr 26 2017 22:00:06 GMT+0000 (UTC)·5·Viewed 358 times

Hi - Since there is no official ShippingEasy library for Nodejs, I was using the documents found here and relying on REST calls https://shippingeasy.readme.io/docs/creating-a-signature I've put together a small script that I've pasted below that I believe should work. However, all I'm getting back is 401 from the response. I'm not sure what I am doing incorrectly. https://pastebin.com/J1KuDLb2 Thanks for your time and help.
Jack Ship
Apr 27, 2017

Correct me if I'm wrong, but it looks like you are calculating the signature value based only on a string made up of:

  1. The operation (e.g. "POST")
  2. The URL
  3. The parameters

You also need to include the actual body of the request itself. So for a POST of a new order, that would be the JSON that contains the order data, as shown here:

https://shippingeasy.readme.io/docs/authentication-signing-requests

Jack Ship
Apr 27, 2017

Correct me if I'm wrong, but it looks like you are calculating the signature value based only on a string made up of:

  1. The operation (e.g. "POST")
  2. The URL
  3. The parameters

You also need to include the actual body of the request itself. So for a POST of a new order, that would be the JSON that contains the order data, as shown here:

https://shippingeasy.readme.io/docs/authentication-signing-requests

R F
Apr 28, 2017

Barry - Thanks for taking a look. I've modified my script based on your suggestion but I am still getting {"errors":[{"message":"Access denied.","status":401}]} as a response from the server. I wish the response had more clues as to what I'm doing incorrectly.

Take a look at v2 if you have another moment - I'm not getting any technical support from ShippingEasy unfortunately

R F
Apr 28, 2017

Oops forgot to link the new script - https://pastebin.com/rmmNUzGj

Jack Ship
Apr 28, 2017

That certainly looks more correct.

Please note that the lack of detail in the error message is intentional - if a request is coming from a hacker we don't really want to provide clues on how to break into our system.

Meanwhile, ShippingEasy does provide API support to paid plan customers - please contact the ShippingEasy Support team and they will provide an email address where you can get help.

  
Markdown is allowed