implydata/plywood-druid-requester

Adding authentication credentials to host connection?

dargue3 opened this issue · 1 comments

I've tried poking around thru the source code and documentation but I can't seem to find any examples of how you include a username/password combination when connecting to a host. I'm thinking it must be something like this:

const druidRequester = druidRequesterFactory({
  host: process.env.DRUID_HOST,
  user: process.env.DRUID_USER,
  password: process.env.DRUID_PASSWORD,
});

We have tried turning the authentication off on our host and we're able to connect fine. Once it is enabled we receive a 401 Unauthorized request. Are we missing something here or is this not supported in the requester API?

Answered my own question by digging thru the source code of plywood-base-api.

For those of you in the future, it looks like this:

const druidRequester = druidRequesterFactory({
  host: process.env.DRUID_HOST,
  authToken: {
    type: 'basic-auth',
    username: process.env.DRUID_USER,
    password: process.env.DRUID_PASSWORD,
  },
});