Please read these guidelines before opening an issue.
Bug Description
Two related problems.
Switching on require_valid_user=true has stopped our clients connecting to Cloudant via the client library in this repo. The POST _session call always returns a 401, despite the correct username and password being provided (in the url or as separate params). A CURL equivalent works ok and returns 200. Here is the code for our call.
that.cloudantInit({ url: CDB_URL, plugins: cloudantRequestRetry }, function (err, cloudant) {...})
Given that CURL works, it must be something the client is doing. Note that we do not provide cookieauth as a plugin. However, when we switched on client debug, we could see that the cookieauth plugin was always being added, whatever value we specified for the plugins parameter (a function, empty array, omitted). It turns out that the following line of code is always executed, and is what is adding cookieauth...
https://github.com/cloudant/nodejs-cloudant/blob/master/cloudant.js#L300
This is in contradiction to the readme. When that line is disabled, clients connect ok with 200. But are unable to take advantage of session cookies.
So two problems:
cookieauth is always added, no way to stop that.
- When
cookieauth is added, clients get 401 when require_valid_user=true.
Catch-22.
We are approaching a code ship deadline, so urgently need a resolution to 1) and preferably 2) as well.
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
Set require_valid_user=true in Cloudant .ini file, start Cloudant, connect using the client, do not specify cookieauth plugin.
2. What you expected to happen
The client should connect with 200.
3. What actually happened
Client gets 401.
Environment details
- Version(s) that are affected by this issue.
4.2.2
- Node.js version
10.15
Please read these guidelines before opening an issue.
Bug Description
Two related problems.
Switching on
require_valid_user=truehas stopped our clients connecting to Cloudant via the client library in this repo. ThePOST _sessioncall always returns a 401, despite the correct username and password being provided (in the url or as separate params). A CURL equivalent works ok and returns 200. Here is the code for our call.that.cloudantInit({ url: CDB_URL, plugins: cloudantRequestRetry }, function (err, cloudant) {...})Given that CURL works, it must be something the client is doing. Note that we do not provide
cookieauthas a plugin. However, when we switched on client debug, we could see that thecookieauthplugin was always being added, whatever value we specified for thepluginsparameter (a function, empty array, omitted). It turns out that the following line of code is always executed, and is what is addingcookieauth...https://github.com/cloudant/nodejs-cloudant/blob/master/cloudant.js#L300
This is in contradiction to the readme. When that line is disabled, clients connect ok with 200. But are unable to take advantage of session cookies.
So two problems:
cookieauthis always added, no way to stop that.cookieauthis added, clients get 401 whenrequire_valid_user=true.Catch-22.
We are approaching a code ship deadline, so urgently need a resolution to 1) and preferably 2) as well.
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
Set
require_valid_user=truein Cloudant.inifile, start Cloudant, connect using the client, do not specifycookieauthplugin.2. What you expected to happen
The client should connect with 200.
3. What actually happened
Client gets 401.
Environment details