Open willemodendaal opened 3 years ago
I wasn't sure if I should re-use the remote PouchDb instance (eg. keep a "singleton"), but I did a little experiment, where I only do db.login
once, but create a brand new remote instance every time I do a db.replicate.to
. When I did this, the _session
api was called every time with username and password. So it "worked", but made cookie auth besides-the-point, because it gets a new AuthSession cookie on every call.
You can try the following in local.ini settings:
[couch_httpd_auth]
allow_persistent_cookies = true
; 1 day = 24 * 60 * 60 = 86400 seconds (set timeout to at least 10 minutes but according to your needs)
timeout = 86400
require_valid_user=true
I use db.login() to log the user in, do some operations (that work fine). Then I wait 10 minutes and try again with the same db instance, but then the calls fail with HTTP 401 Unauthorized.
I don't see any traffic in Chrome's "Network" tab to indicate that tokens were refreshed.
This is what my CouchDb ini file looks like (maybe I'm missing something here?)
My javascript code that connects to the remote couchDb looks as follows.
configureRemoteCouch
andloginToRemoteCouch
is only called once by my code, and from there I use the same remoteCouch instance:The javascript code that pushes documents to the local pouchDb and then replicates to the remote looks as follows:
... this is the code where I see the problem. It works within the 10 minute period, but not once the period has elapsed.
Expected Behavior
I'd expect all calls to succeed. The first calls, done immediately after logging in, as well as additional calls after 10 minutes of inactivity.
Current Behavior
Calls made after 10 minutes fail with HTTP 401.
Your Environment