I have create an admin server. If I try to access to http://localhost:5984/_utils/config.html
futon ask me the credential for administrator, and if I digit username e password all work perfectly. But if I try to run the command:
curl -X POST http://username:password@localhost:5984/_session
couchdb response with a HTTP 401 error. The message is
{error":"unauthorized","reason":"Name or password is incorrect."}
but I'm sure that the username and the password are correct. In effect if I try to run the command:
curl -X GET "http://username:password@localhost:5984/_session"
the response is ok and the content message tell me that I have the role of _admin.
Why therefore the POST method not working?
You need to
POST
the username and password as a URL encodedPOST
body, or as a JSON object:or:
And you need to set the correct Content-Type header for either.
See the official docs http://docs.couchdb.org/en/latest/api/server/authn.html for details