Biscoint / biscoint-api-node

NodeJS library for interacting with biscoint.io's API.
MIT License
15 stars 7 forks source link

Constantly receiving "Invalid authorization headers" response #2

Open mrherickz opened 4 years ago

mrherickz commented 4 years ago

While playing around with Biscoint's node client, I constantly get this response in the authenticated endpoints:

{ 
  code: 4003,
  error: 'Forbidden',
  details: 'Invalid authorization headers' 
}

I suspect the issue is related to the nonce or the actual request signing.

bolaum commented 4 years ago

You are right. It's probably a nonce issue. You should wait a few ms between calls or, even better, wait for a request to complete before sending the next one. There is a delay implemented in the lib, but maybe it's not enough given the delay/round-trip between client and server.

Nonce should always be a bigger integer then the one sent last time for a given key, so if an async request T arrives after request T+1, which is possible bc of different routes, for example, it fails.