title: Can't get PouchDB authentication working
body: <p>I've tried numerous configurations but failed to make this Karma/Jasmine unit test pass.  Any ideas what I'm missing?</p>
  
  <p>Running CouchDb 1.6.1 . Jasmine unit test is running inside IntelliJ IDEA. </p>
  
  <pre><code>describe("CouchDb Auth")      
    it("Test login", function (done) {
  
      var auth = {
        username: 'demo',
        password: 'omed'
      }
  
      var url = 'http://127.0.0.1:5984/demo';
  
      var ajaxOpts = {
        headers: {
      // 'Access-Control-Allow-Credentials': 'true',
      'Authorization': 'Basic ' + window.btoa(auth.username + ':' + auth.password),
        }
      };
  
      var db = new PouchDB(url, {skipSetup: true});
  
      db.login(auth.username, auth.password, ajaxOpts)
        .then(function(res) {
      console.log(res);
      done();
        })
        .catch(function(err) {
      console.log(err);
  
      done('Failed to login');
        });
    });
  });
  </code></pre>
  
  <p><code>local.ini</code>  File:  Couch 1.6.1</p>
  
  <pre><code>[couchdb]
  ;max_document_size = 4294967296 ; bytes
  uuid = 3fe8f6afb42b8fde93b8b66818b3476c
  
  [httpd]
  bind_address = 0.0.0.0
  enable_cors = true
  
  ; Uncomment next line to trigger basic-auth popup on unauthorized requests.
  WWW-Authenticate = Basic realm="administrator"
  ; WWW-Authenticate = Other realm="app"
  
  [cors]
  ; You can’t set origins: * and credentials = true at the same time.
  credentials = true
  ; List of origins separated by a comma, * means accept all
  ; Origins must include the scheme: http://example.com
  origins = http://localhost:9876
  ; List of accepted headers separated by a comma
  headers = accept, authorization, content-type, origin, referer, cache-control, x-requested-with, x-csrf-token
  ; List of accepted methods
  methods = GET, PUT, POST, HEAD, DELETE
  
  [couch_httpd_auth]
  secret = somesecretstuff
  require_valid_user = true
  
  [log]
  level = debug
  
  [ssl]
  ;cert_file = /full/path/to/server_cert.pem
  ;key_file = /full/path/to/server_key.pem
  ;password = somepassword
  ; set to true to validate peer certificates
  verify_ssl_certificates = false
  ; Path to file containing PEM encoded CA certificates (trusted
  ; certificates used for verifying a peer certificate). May be omitted if
  ; you do not want to verify the peer.
  ;cacert_file = /full/path/to/cacertf
  ; The verification fun (optional) if not specified, the default
  ; verification fun will be used.
  ;verify_fun = {Module, VerifyFun}
  ; maximum peer certificate depth
  ssl_certificate_max_depth = 1
  
  [vhosts]
  
  [update_notification]
  
  [admins]
  ;admin = mysecretpassword
  
  ; demo = omed
  demo = -pbkdf2-606718f546624acae3a7ed561540352921281e7c,a1d619524376dfbd0f8f6547856d74eb,10
  </code></pre>