glynnbird commented on issue #174:
URL: https://github.com/apache/couchdb-nano/issues/174#issuecomment-1377327187

   This is a problem because Node.js's URL parser doesn't like "special 
characters" in the password:
   
   i.e. 
   
   ```js
   const { URL } = require('url')
   const u = new URL('http://admin:g[?6asdwrF@localhost:5984')
   Uncaught TypeError [ERR_INVALID_URL]: Invalid URL
       at __node_internal_captureLargerStackTrace (node:internal/errors:484:5)
       at new NodeError (node:internal/errors:393:5)
       at URL.onParseError (node:internal/url:565:9)
       at new URL (node:internal/url:645:5) {
     input: 'http://admin:g[?6asdwrF@localhost:5984',
     code: 'ERR_INVALID_URL'
   }
   ```
   
   a work around, as @LyteFM points out is to provide the credentials 
separately:
   
   ```js
   const nano = Nano('http://127.0.0.1:5984)
   await nano.auth('admin', '[!5gdg@&!')
   ```
   
   I'd be curious to know what the "URL spec" (if there is such a thing) says 
about putting passwords in URLs. I'm happy to fix this in Nano if there's a 
standard way of approaching this.


-- 
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]

Reply via email to