You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "dbeniteza (via GitHub)" <gi...@apache.org> on 2023/06/15 11:49:38 UTC

[GitHub] [couchdb] dbeniteza opened a new issue, #4642: DOCUMENTATION - Creating a new user method HTTP method is wrong

dbeniteza opened a new issue, #4642:
URL: https://github.com/apache/couchdb/issues/4642

   Hello,
   
   I've found an error on the documentation section [1.5.2.2. Creating a New User](https://docs.couchdb.org/en/stable/intro/security.html#creating-a-new-user).
   
   It is said "_Creating a new user is a very trivial operation. You just need to do a [PUT](https://tools.ietf.org/html/rfc7231#section-4.3.4) request with the user’s data to CouchDB_"
   
   This is wrong, since the PUT method will try to create the _users database. The correct HTTP method is POST.
   
   Please correct this typo in the documentation.
   
   As a suggestion, it would help to explicitly include in this documentation section that this call must be done with an admin user. Consider including in the curl example something like this:
   ```
   curl -X **POST** <admin_user>:<admin_password>@localhost:5984/_users/org.couchdb.user:jan \
        -H "Accept: application/json" \
        -H "Content-Type: application/json" \
        -d '{"name": "jan", "password": "apple", "roles": [], "type": "user"}'
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on issue #4642: DOCUMENTATION - Creating a new user method HTTP method is wrong

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on issue #4642:
URL: https://github.com/apache/couchdb/issues/4642#issuecomment-1593175564

   > since the PUT method will try to create the _users database. The correct HTTP method is POST.
   
   PUT should not create a new database but a new user document
   
   The URL is `http://localhost:5984/_users/org.couchdb.user:jan` `_users` is the database and `org.couchdb.user:jan` is the document ID. PUT is also the correct method in this case as we're creating or replacing a resource and we're identifying by its resource (the URL path).
   
   Maybe we should assert or include that we are assuming in the documentation that `_users` db has already been created  and the `jan` user has not been added to it yet.
   
   Good point however that this needs an admin user and admin password. That is mentioned above in [Authentication Database](https://docs.couchdb.org/en/stable/intro/security.html#authentication-database) but that may be easy to miss so showing it in the example would make it easier to see.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva closed issue #4642: DOCUMENTATION - Creating a new user method HTTP method is wrong

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva closed issue #4642: DOCUMENTATION - Creating a new user method HTTP method is wrong
URL: https://github.com/apache/couchdb/issues/4642


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org