Reputation: 19405
Using the apache/couchdb:2
docker image. I've added a user in couchdb (bloggs) and a database (notes) and added the user to the database, using Fauxton.
Then using pouchdb-authentication I've tried:
var db = new PouchDB('http://couchdb.korea.lan:5984/notes', {skip_setup: true});
db.logIn('bloggs', 'mypassword').then(function() {
db.put(doc);
});
The login succeeds, I can do a console.log()
or logout at that point. But the db.put()
call fails with a 401:
{"error":"unauthorized","reason":"You are not authorized to access this db."}
The container log output shows the username if I do a db.logout() but the db.put() says "undefined" where the username appears on the logout.
Any idea what I'm missing?
Upvotes: 1
Views: 633
Reputation: 19405
Nevermind, looks like a bug.
I was just using the latest pouchdb version on a CDN. Rolling back from 7.0.0 to 6.4.3 has fixed it.
Upvotes: 3