PouchDB authentication: Create new CouchDB users

半腔热情 提交于 2019-12-21 04:56:07

问题


I use the PouchDB-authentication plugin and I love it.

However, I'm a little confused about the signup process and maybe I don't use it the right way. I use it to create new users in my CouchDB database but I don't understand why it is associated with a specific database? Since I create CouchDB user before his specific database, I have to use a dummy database to create the new user:

// Create or get a database on the CouchDB server to further create a new user
var remoteDB = new PouchDB('http://169.254.197.198:5984/dummy');

// Signup to this db in order to create new user in the CouchDB server
remoteDB.signUp(document.register.username.value,
  document.register.password1.value).then(function (reponse){
}).then(function (reponse) {
  // handle response
}).catch(function (error) {
  // handle error
});

Question: Is there a way to create a new users independently of a database?


回答1:


It's a design flaw in pouchdb-authentication. Technically, your users are defined globally relative to the entire CouchDB server, but pouchdb-authentication tries to make things simpler by attaching itself to a PouchDB object linked to a single CouchDB database.

The easiest thing, if you want to continue using pouchdb-authentication, is yeah, to use a dummy database. Sorry about that; I couldn't come up with a better system. :/



来源:https://stackoverflow.com/questions/30028575/pouchdb-authentication-create-new-couchdb-users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!