pouchdb-authentication: Session cookies problem

I’m using this with Electron and I’m running into problems.

I login ok but when I issue a getUser it responds 404 which means I’m not logged in.

A getSession gives the following response

{
    "info": {
        "authentication_db": "_users",
        "authentication_handlers": ["oauth", "cookie", "default"]
    },
    "ok": true,
    "userCtx": {
        "name": null,
        "roles": []
    }
}

The name is null and there is no "authenticated": "cookie", which makes me think that there is something strange about the way Electron is handling cookies.

Anybody got any suggestions as to what is happening and how I might get around this problem.

About this issue

Most upvoted comments

I can verify a similar problem with safari on Mac and iPhone. The problem is caused by very restrictive cookie policy of Safari, which does not allow another domain to set a cookie for this domain. Example: db.domain.com is a couchdb and whereas domain.com is the website, then website on domain.com cannot see the cookie set by db.domain.com. There are a couple workarounds on google (using iframes or redirects). Basic Auth works just fine. Improvment pouch-authentification can provide methods to interact with couchdb using Basic Auth? @ammichael My workaround is not using pouch-authentification but instead use plain pouchdb (https + Basic Auth) and make ajax requests to change user password etc manually. Through, a little sh*tty…

@ptitjes Actually I have this problem with Safari, with Ionic app. But gonna give it a try and will report asap

@ptitjes pouch-auth 1.1.0 uses just credentials provided in url (verified and worked) but not provided in options.auth (verified and fails). I opened a new issue #204 Can you ping me when you released a fix. I will update then the pouchdb clojurescript wrappers. Thanks a lot for your help!