Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

pouchdb-authentication

pouchdb-community5kApache-2.01.1.3TypeScript support: included

PouchDB Authentication

pouch, pouchdb, authentication, couch, couchdb

readme

PouchDB Authentication

Build Status Greenkeeper badge npm version

PouchDB Authentication logo by nickcolley

Easy user authentication for PouchDB/CouchDB.

var db = new PouchDB('http://mysite:5984/mydb', {skip_setup: true});
db.logIn('batman', 'brucewayne').then(function (batman) {
  console.log("I'm Batman.");
  return db.logOut();
});

Overview

You know what's hard? Security. You know what makes security really easy? CouchDB.

That's right, CouchDB is more than a database: it's also a RESTful web server with a built-in authentication framework. And it boasts some top-notch security features:

  • salts and hashes passwords automatically with PBKDF2
  • stores a cookie in the browser
  • refreshes the cookie every 10 minutes (default)

And best of all, CouchDB does it with good ol'-fashioned HTTP. Just open up the network tab and watch the JSON fly back and forth.

To get started, just install CouchDB, throw in a little SSL, and you've got everything you need for your site's authentication.

Project status

This plugin uses vanilla CouchDB. The goal is to give you a lightweight authentication API that doesn't require anything fancy – no additional server daemons, no third-party providers, just straight-up Pouch and Couch.

So this is more of a reference implementation than an all-in-one solution. If there's a feature missing that you need, you will probably need to write a custom server (see the CouchDB Authentication recipes section for details).

Since version 1.0.0, this plugin does support Node.js.

Using PouchDB Authentication

Changelog

PouchDB Authentication follows semantic versioning. To see a changelog with all PouchDB Authentication releases, check out the Github releases page.

Contributing

We use standard-version for release versioning along with Angular-style commit messages to automate the changelog generation. To help you make good commit messages, you are advised to install and use commitizen.

PouchDB Authentication is heavily tested, so you'll also want to check out the testing guide.

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.1.3 (2018-05-19)

Bug Fixes

  • build: publish browserified version (46e883e)

1.1.2 (2018-02-03)

Bug Fixes

  • package: update url-join to version 4.0.0 (fe89208)
  • urls: enable databases that are not hosted on domain root (ac2e2b0), closes #215

1.1.1 (2018-01-20)

Bug Fixes

  • auth: also use Basic Authentication information database opts (8b1d191), closes #204
  • package: update url-join to version 2.0.5 (6a627d1), closes #205
  • package: update url-join to version 3.0.0 (d7b27ae)

1.1.0 (2017-12-25)

Features

  • types: package typescript type declarations (e59ad40)

1.0.0 (2017-12-17)

Bug Fixes

  • ajax: correctly handle Basic authentication (19f547b), closes #109
  • browser: plugin registration bug introduced in ES6 move (cd12d06)
  • nodejs: correctly set ajax request's body for login (5b61b00), closes #127 #130 #141
  • package: update pouchdb to version ~6.4.0 (f0c45b5)
  • putUser: ensure reserved words are enforced in metadata (b1ea26a)
  • urls: replace base URL regex with url-parse (7472135), closes #150 #160
  • urls: respect DB prefix for base URL if set (d600426), closes #158

Features

  • admins: add signUpAdmin and deleteAdmin (cb8991d)
  • package: move to ES6 with rollup build (b420ad4)
  • putUser: take roles in account (7f44c9e), closes #114
  • users: add deleteUser (8e187e7)

BREAKING CHANGES

  • putUser: In both signUp and putUser, 'id', 'rev', 'name', 'type', 'roles', 'password', 'password_scheme', 'iterations', 'derived_key', 'salt' are now all reserved words, and 'metadata' is not a reserved word anymore.