couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Seb (Created) (JIRA)" <>
Subject [jira] [Created] (COUCHDB-1452) Can't POST /_session with require_valid_user=true (Cookie authentication)
Date Sun, 01 Apr 2012 13:06:28 GMT
Can't POST /_session with require_valid_user=true (Cookie authentication)

                 Key: COUCHDB-1452
             Project: CouchDB
          Issue Type: Bug
    Affects Versions: 1.1.1
         Environment: Fedora 16

[root@CouchDBTest ~]# uname -a
Linux CouchDBTest 3.3.0-8.fc16.x86_64 #1 SMP Thu Mar 29 18:37:19 UTC 2012 x86_64 x86_64 x86_64
            Reporter: Seb


I'm playing with couchdb and having a small problem with authentication (I would like to be
cookie+https only)

With require_valid_user, every action must be authenticated.

Then we need to authenticate to couchdb in order to POST to /_session.

So, if you disable classical HTTP auth, you can't authenticate users on couchdb only with

[root@CouchDBTest ~]# curl -vX POST http://localhost:5984/_session -H 'Content-Type: application/x-www-form-urlencoded'
-d 'name=admin&password=this_is_a_test'
* About to connect() to localhost port 5984 (#0)
*   Trying ::1... Connection refused
*   Trying connected
* Connected to localhost ( port 5984 (#0)
> POST /_session HTTP/1.1
> User-Agent: curl/7.21.7 (x86_64-redhat-linux-gnu) libcurl/7.21.7 NSS/ zlib/1.2.5
libidn/1.22 libssh2/1.2.7
> Host: localhost:5984
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 34
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Basic realm="administrator"
< Server: CouchDB/1.1.1 (Erlang OTP/R14B04)
< Date: Sun, 01 Apr 2012 14:58:13 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 61
< Cache-Control: must-revalidate
{"error":"unauthorized","reason":"Authentication required."}
* Connection #0 to host localhost left intact
* Closing connection #0

The workaround to obtain a cookie with require_valid_user=true is to authenticate with classical
HTTP auth then to auth again with a POST on _session.

Not POST /_session should be allowed even for require_valid_user=true ?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message