GitHub user rnewson added a comment to the discussion: How does `users_db_public` work? (CouchDB 3.5.1)
I think perhaps you are just passing the wrong credentials? You can confirm it by trying to GET the `/_session` endpoint with basic auth. Below I show that a user can fetch their own document if they are authenticated, it works whether users_db_public is false (default) or true. ``` ~ curl http://localhost:5984/_users/org.couchdb.user:rnewson -XPUT -d '{}' {"error":"forbidden","reason":"doc.type must be user"} ➜ ~ curl http://localhost:5984/_users/org.couchdb.user:rnewson -XPUT -d '{"type":"user"}' {"error":"forbidden","reason":"doc.name is required"} ➜ ~ curl http://localhost:5984/_users/org.couchdb.user:rnewson -XPUT -d '{"type":"user","name":"rnewson"}' {"error":"forbidden","reason":"doc.roles must exist"} ➜ ~ curl http://localhost:5984/_users/org.couchdb.user:rnewson -XPUT -d '{"type":"user","name":"rnewson","roles":[],"password":"wibble"}' {"ok":true,"id":"org.couchdb.user:rnewson","rev":"1-a71ab3df6d73329402c357eb8969b997"} ➜ ~ curl http://rnewson:wibble@localhost:5984/_users/org.couchdb.user:rnewson {"_id":"org.couchdb.user:rnewson","_rev":"1-a71ab3df6d73329402c357eb8969b997","password_scheme":"pbkdf2","pbkdf2_prf":"sha256","salt":"0472b43b8ceff9e0712bd552a4593de4","iterations":600000,"derived_key":"6392866e5afe7b4cdb446cac97605b76a1a6b023c0a2e013fd6cafc959cdb310","type":"user","name":"rnewson","roles":[]} ➜ ~ curl http://localhost:5984/_session -d 'name=rnewson&password=wibble' -i HTTP/1.1 200 OK cache-control: must-revalidate content-length: 40 content-type: application/json date: Thu, 02 Apr 2026 09:13:48 GMT server: CouchDB/3.5.1-3083d28-dirty (Erlang OTP/26) set-cookie: AuthSession=cm5ld3Nvbjo2OUNFMzM0RDpl0c7UczY5vlswc0zpUKi3q1mvuBdihhFOkHc7VwpOng; Version=1; Expires=Thu, 02-Apr-2026 09:23:49 GMT; Max-Age=600; Path=/; HttpOnly {"ok":true,"name":"rnewson","roles":[]} ➜ ~ curl http://localhost:5984/_users/org.couchdb.user:rnewson -H 'cookie: AuthSession=cm5ld3Nvbjo2OUNFMzM0RDpl0c7UczY5vlswc0zpUKi3q1mvuBdihhFOkHc7VwpOng' {"_id":"org.couchdb.user:rnewson","_rev":"1-a71ab3df6d73329402c357eb8969b997","password_scheme":"pbkdf2","pbkdf2_prf":"sha256","salt":"0472b43b8ceff9e0712bd552a4593de4","iterations":600000,"derived_key":"6392866e5afe7b4cdb446cac97605b76a1a6b023c0a2e013fd6cafc959cdb310","type":"user","name":"rnewson","roles":[]} ``` GitHub link: https://github.com/apache/couchdb/discussions/5957#discussioncomment-16420785 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
