【发布时间】:2013-09-14 15:08:07
【问题描述】:
我试图弄清楚如何在 CouchDB 1.3.1 中使用基本身份验证(即http://test:test@localhost:5984/mydb)。
在蒲团里:
- 我创建了一个数据库
mydb - 我为它设置了两个用户。在 Security 选项卡中:一位具有读取权限的成员
["test"]和一位管理员["admin"]
然后我只是测试连接。
使用 curl:
curl GET http://localhost:5984/mydb
未经授权返回401,这很好。
curl GET http://test:test@localhost:5984/mydb
返回200,因此使用 curl 一切正常。
使用浏览器或 $.ajax:
两者都在 URL http://test:test@localhost:5984/mydb 上返回 401。
那么,问题:
- 使用
curl GET或使用$.ajax GET(或浏览器)有什么区别? - 我是否缺少 CouchDB 或其他允许执行此类身份验证的配置?
【问题讨论】: