I can not pass the session correctly to CouchDB. Here is my code:
var nano = require('nano')({
'url': 'http://myip:5984'
});
var conf = require('./conf');
nano.auth(conf.user.name, conf.user.password, function (err, body, headers) {
if (err) {
return callback(err);
}
if (headers && headers['set-cookie']) {
var nano = require('nano')({
'url':'http://myip:5984',
'cookie': headers['set-cookie']
});
}
});
But when I make a call I always get the following message:
Error: Bad DB response: {"error":"unauthorized","reason":"You are not authorized to access this db."}