How does users_db_public work? (CouchDB 3.5.1)
#5957
Replies: 2 comments
-
|
I think perhaps you are just passing the wrong credentials? You can confirm it by trying to GET the |
Beta Was this translation helpful? Give feedback.
-
|
Hi, @rnewson! Thank you for your reply and your examples. Unfortunately, I can't reproduce what you have. Here's what I get. Unexpected behaviorUsing the curl --user 'example.com/[email protected]:password' \
'http://localhost:5984/_users/org.couchdb.user%3Aexample.com%2Fperson%40mailhost.com'
{"error":"forbidden","reason":"You are not allowed to access this db."}Using a JWT with the curl -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJleGFtcGxlLmNvbS9wZXJzb25AbWFpbGhvc3QuY29tIiwiZXhwIjoxNTE2MjM5MDIyMCwicm9sZXMiOltdfQ.fro4XKGs9JrABBWkvXAtGHnuniwlxYeGGH_YW3OKWwk' \
http://localhost:5984/_users/org.couchdb.user%3Aexample.com%2Fperson%40mailhost.com
{"error":"forbidden","reason":"You are not allowed to access this db."}Expected behaviorUsing the admin user and Basic Auth, I get a successful response. curl --user "admin:password" http://localhost:5984/_users/org.couchdb.user%3Aexample.com%2Fperson%40mailhost.com
{"_id":"org.couchdb.user:example.com/[email protected]","_rev":"2-0d3c1123adaf781b754cc34c316b9f58","password_scheme":"pbkdf2","pbkdf2_prf":"sha256","salt":"bc00d465df6bf7c80248cc470116ebdd","iterations":600000,"derived_key":"dc6f67846acbfe4006406e27a9918b77f700ade03918fb4fbbec7f9a1921d1c2","name":"example.com/[email protected]","roles":[],"type":"user"}Using a user with a JWT and the curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTUxNjIzOTAyMjAsInJvbGVzIjpbIl9hZG1pbiJdfQ.MPNmweY1wwOdNwAjW8CTnaNYHs3yC_xRlNGT8vx_3Oo" \
http://localhost:5984/_users/org.couchdb.user%3Aexample.com%2Fperson%40mailhost.com
{"_id":"org.couchdb.user:example.com/[email protected]","_rev":"2-0d3c1123adaf781b754cc34c316b9f58","password_scheme":"pbkdf2","pbkdf2_prf":"sha256","salt":"bc00d465df6bf7c80248cc470116ebdd","iterations":600000,"derived_key":"dc6f67846acbfe4006406e27a9918b77f700ade03918fb4fbbec7f9a1921d1c2","name":"example.com/[email protected]","roles":[],"type":"user"}Using the curl --user 'example.com/[email protected]:not-my-password' \
'http://localhost:5984/_users/org.couchdb.user%3Aexample.com%2Fperson%40mailhost.com'
{"error":"unauthorized","reason":"Name or password is incorrect."}Using the curl --user 'example.com/[email protected]:password' \
http://localhost:5984/userdb-6578616d706c652e636f6d2f706572736f6e406d61696c686f73742e636f6d/_all_docs
{"total_rows":0,"offset":0,"rows":[]}Using a JWT with the curl -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJleGFtcGxlLmNvbS9wZXJzb25AbWFpbGhvc3QuY29tIiwiZXhwIjoxNTE2MjM5MDIyMCwicm9sZXMiOltdfQ.fro4XKGs9JrABBWkvXAtGHnuniwlxYeGGH_YW3OKWwk' \
http://localhost:5984/userdb-6578616d706c652e636f6d2f706572736f6e406d61696c686f73742e636f6d/_all_docs
{"total_rows":0,"offset":0,"rows":[]}Extra infoMy
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Using CouchDB v3.5.1, I updated my configuration to include the following settings.
The way I read the documentation is that, since I don't set
public_fields, an authenticated user should be able to access their user record in_users:But, I can't get it to work with either Basic or JWT authentication. I only get
401 Forbiddenresults. (EDITED from "Cookie" to "Basic".)Is this a bug?
Full config
Beta Was this translation helpful? Give feedback.
All reactions