couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject creating a session then trying to save a doc fails due to authorization problems
Date Tue, 24 Aug 2010 19:14:43 GMT

 I am using couch.js to get a session. The session is created successfully according to firebug.
Next I want to add a new document to a database I've created

The database is called joe at localhost:5984/joe
joe's login pass is joe:cool
The session command goes through correctly in firebug but just returns json of


Next I want to use the following in javascript

mydb = new CouchDB("joe");
doc={"username":"joe","filename":"joesfile","data":"here is joe's data"};;

But this fails due to authorization problems.
Is there something I'm going to need to include in the options in the,options)?

The couch.js function is
 // Save a document to the database = function(doc, options) {
    if (doc._id == undefined) {
      doc._id = CouchDB.newUuids(1)[0];

    this.last_req = this.request("PUT", this.uri  +
        encodeURIComponent(doc._id) + encodeOptions(options),
        {body: JSON.stringify(doc)});
    var result = JSON.parse(this.last_req.responseText);
    doc._rev = result.rev;
    return result;

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message