PouchDB身份验证:创建新的CouchDB用户 [英] PouchDB authentication: Create new CouchDB users

查看:88
本文介绍了PouchDB身份验证:创建新的CouchDB用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PouchDB身份验证插件,我喜欢它.

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

但是,我对注册过程有些困惑,也许我使用的方式不正确.我用它在我的CouchDB数据库中创建新的用户,但我不明白为什么它是与特定的数据库相关联?由于我自己的特定数据库之前创建CouchDB的用户,我必须使用一个虚拟的数据库中创建新用户:

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?

推荐答案

这是pouchdb身份验证中的设计缺陷.从技术上讲,您的用户是相对于整个CouchDB服务器进行全局定义的,但是pouchdb身份验证通过将自身附加到链接到单个CouchDB数据库的PouchDB对象,试图使事情变得更简单.

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.

如果要继续使用pouchdb身份验证,最简单的方法是使用虚拟数据库.对于那个很抱歉;我无法提出一个更好的系统. :/

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. :/

这篇关于PouchDB身份验证:创建新的CouchDB用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆