node js how to basic auth to specific urk
var request = require('request')
var username = 'fooUsername'
var password = 'fooPassword'
var options = {
url: 'http://localhost:1234/api/res/xyz',
auth: {
user: username,
password: password
}
}
request(options, function (err, res, body) {
if (err) {
console.dir(err)
return
}
console.dir('headers', res.headers)
console.dir('status code', res.statusCode)
console.dir(body)
})
Also in JavaScript:
- react native dynamic view size
- javascript create script tag
- port already in use node js
- js what does var mean
- js query string
- unordered list in react native
- p5.js put canvas in specific place
- js check if variable is string
- get latest file from s3 bucket javascript
- sort array by string length javascript
- javascript create checkbox with label
- angular 6 key value pair getvalue example
- regular expression arabic and persion
- vuejs
- The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object. scoop
- fetch is not defined amazon-cognito-identity-js
- operator to return specific data of a mongodb query
- setting property to method in child class javascript
- jquery remove multiple class
- format currency javascript
- js detect mobile
- node js read files recursively
- pass argument to event listener javascript
- jquery get next element