added auth lib

This commit is contained in:
Max Thayer 2013-08-21 23:54:28 -04:00
parent 8bd3f97cc0
commit 7a9d8f85ca
1 changed files with 12 additions and 0 deletions

12
lib/auth.js Normal file
View File

@ -0,0 +1,12 @@
exports.getCookie = function(opts, cb){
var db = nano(opts.db.url);
nano.auth(opts.username, opts.password, function(err, body, headers){
if(err){
cb(err);
}else{
if(headers && headers['set-cookie']){
cb(null, headers['set-cookie']);
}
}
});
}