I just downloaded and installed CouchDB v3
.
On first start, it prompted me to set an admin password which I did.
For the web app that I'm building, I want to use the CouchDB user authentication feature, so I created a new _users
database using the Fauxton UI.
After creating the _users
database I made a call to the REST API to insert a new user (this is the example code taken from the documentation):
$ curl -X PUT http://localhost:5984/_users/org.couchdb.user:jan \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "jan", "password": "apple", "roles": [], "type": "user"}'
Instead of the expected response
{"ok":true,"id":"org.couchdb.user:jan","rev":..."}
I'm getting
{"error":"unauthorized","reason":"You are not authorized to access this db."}
When adding the admin credentials to the API call, it works as expected:
$ curl -X PUT http://admin:____@localhost:5984/_users/org.couchdb.user:jan \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "jan", "password": "apple", "roles": [], "type": "user"}'
{"ok":true,"id":"org.couchdb.user:jan","rev":"..."}
My question:
Are there any settings or permissions I can set to make the request work without having to add the admin credentials? (AFAIK this worked fine in v2.x
)