had*_*enj 5 authentication couchdb pouchdb
我使用PouchDB认证插件,我喜欢它.
但是,我对注册过程有点困惑,也许我没有以正确的方式使用它.我用它在我的CouchDB数据库中创建新用户但我不明白为什么它与特定数据库相关联?由于我在特定数据库之前创建了CouchDB用户,因此我必须使用虚拟数据库来创建新用户:
// 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
});
Run Code Online (Sandbox Code Playgroud)
问题:有没有办法独立于数据库创建新用户?
这是pouchdb认证的一个设计缺陷.从技术上讲,您的用户是相对于整个CouchDB服务器全局定义的,但是pouchdb-authentication尝试通过将自身附加到链接到单个CouchDB数据库的PouchDB对象来简化操作.
最简单的事情,如果你想继续使用pouchdb-authentication,是的,使用虚拟数据库.对于那个很抱歉; 我无法想出一个更好的系统.:/
| 归档时间: |
|
| 查看次数: |
2338 次 |
| 最近记录: |