Adding a basic Authentication to my pm.sendrequest function

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

I’m trying to add Basic Authentication to my pm.sendrequest function. Is there a good example of a setup for the different auth types for the pm.sendrequest function?

This is a good resource for that:

Maybe something like:

let options = {
  url: 'https://www.example.com',
  auth: {
    user: username,
    password: password
  }
}

pm.sendRequest(options, function (err, res) {
  if (err) {
    console.dir(err)
    return
  }
})
2 Likes