pouchdb-community / pouchdb-authentication

User authentication plugin for PouchDB and CouchDB.
Apache License 2.0
775 stars 118 forks source link

Auth fail when using multiple dbs #240

Closed nofear87 closed 6 years ago

nofear87 commented 6 years ago

I have multiple services...each of them looks like the example:

import PouchDB from 'pouchdb';
import PouchAuth from 'pouchdb-authentication'
PouchDB.plugin(PouchAuth);

remoteDB.logIn(user.persID, user.password)
   .then((res) => console.log(res))
   .catch((err) => console.log(er)
);
this._pouch
   .sync(remoteDB, {
      live: true,
      retry: true
   }).on('change', (changes) => {
      console.log(changes, 'app data');
   }).on('error', function (err) {
      console.log(er);
   });
};

As soon I use a second service with pouch I got the authentications problems. With one service everything is fine.

Is there something special when using auth plugin for multiple databases?