GitHub user carlosduclos opened an issue:

    https://github.com/apache/couchdb-nano/issues/31

    Cannot specify auth in initialization object

    [Original issue](https://github.com/dscape/nano/issues/336)
    
    __timwis__
    I'd like to pass a username and password to nano without storing it in the 
couchdb url string, so that the url string can be used in other parts of the 
application that require separate authentication. The documentation suggests I 
can pass an auth object into the requestDefaults property of the initialization 
object, like this:
    
    var db = require('nano')({
      url: 'http://localhost:5984',
      requestDefaults: {
        auth: { user: 'admin', pass: 'foo' }
      }
    })
    But this seems to have no effect on the request, resulting in the standard 
401 unauthorized error. Passing the same user/pass as part of the url 
(http://admin:foo@localhost:5984) works fine.
    
    In the meantime, I'm getting around this using a function that deconstructs 
the url, adds in the user/pass, and reconstructs it. But I'd prefer this 
cleaner approach.
    
    I also tried upgrading the version of request and I think I did it 
correctly... Am I doing it wrong or is this a bug?
    
    __timwis__
    may be related to #278

----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to