From ba25597292a581b77fdec5c9e176b48ce75f76ea Mon Sep 17 00:00:00 2001 From: Max Thayer Date: Wed, 21 Aug 2013 23:54:28 -0400 Subject: [PATCH] added auth lib --- lib/auth.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/auth.js diff --git a/lib/auth.js b/lib/auth.js new file mode 100644 index 0000000..16fe02d --- /dev/null +++ b/lib/auth.js @@ -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']); + } + } + }); +} \ No newline at end of file