How to create a database in CouchDB indicating the username and password How to create a database in CouchDB indicating the username and password curl curl

How to create a database in CouchDB indicating the username and password


I had the same problem -> you have to use the HTTP Authentication in the header.So just add this header lines to your request:

private static void setHeader(HttpRequestBase request)  {    request.setHeader("Accept", "application/json");    request.setHeader("Content-type", "application/json");    request.setHeader("Authorization", "Basic base64(username:password)");}

keep in mind that you have to encode the phrase "username:password" with base64.this looks something like this:

request.setHeader("Authorization", "Basic 39jdlf9udflkjJKDKeuoijdfoier");


You could have a look at this blogpost on libcouch-android. It has some nice features that really support Android development with CouchDB. For example automatically creating databases and passwords for applications, so users have transparent usage of CouchDB (if wanted).

Also, it is offering access to the RPC methods of CouchDB, so you can start and stop the DB from your application's lifecycles.

Regarding security, I just had this summed up here in this thread.