Unauthorized access 401 error - nodejs client

Hi there -

I’m trying to follow the very straightforward (outdated, incorrect, correct but what is going on?) instructions here: GitHub - pipedrive/client-nodejs: Pipedrive API client for NodeJS to get a very simply script up and running against the API.

I’ve validated using http requests (eg curl) that the api token is correct.

But, using the client, I’m getting 401 unauthorized with no sign that it’s actually passing the query string auth over to the rest endpoint.

I’ve looked at the source for the client and I don’t see anything obvious.

Any help is appreciated!

Initializing:

const Pipedrive = require('pipedrive');
...
const pdClient = new Pipedrive.ApiClient();
pdClient.authentications.api_key.apiKey = "my api token that's correct"
const api = new Pipedrive.DealsApi(pdClient);
const opts = {};
api.getDealsSummary(opts).then((data) => {
    console.log('API called successfully. Returned data: ' + data);
  }, (error) => {
    console.error(error);
  });

The call:

pdClient.isApiTokenSet()

returns true.

The https request / response is returned (httpInfo) with the failure. No query strings are set.

Thanks!

Ah, nevermind - I figured out the issue was that the initialization of the client api token was happening inside of a child process due to how I store the key. That explains the unexplained!