LyteFM commented on issue #174:
URL: https://github.com/apache/couchdb-nano/issues/174#issuecomment-1021215664
Note: Adding the Auth header manually like this is **not** a good idea in
nano 9:
``` javascript
requestDefaults: {
headers: {
Authorization:"Basic " + new
Buffer("admin:"+cdbpass).toString('base64')
}
}
```
Because this will cause nano to log passwords on errors, see [this
issue](https://github.com/apache/couchdb-nano/issues/255). [This
commit](https://github.com/apache/couchdb-nano/commit/c84d0a43b13edc888a2a339f7fb057ad66d3d3fe)
shows how passwords are redacted.
So if you don't want to use cookie auth (which requires to await
`nano.auth(..)`), this is a good way to go with special characters inside the
password:
``` javascript
const opts = {
url: `http://couchdb:5984`,
requestDefaults: {
headers: {
auth: {
username: "admin",
password: "/Pa$$|w0rd^",
},
}
}
}
const couchdb = nano(opts)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]