Cool, thanks guys! Klaus you were right, it works now :) On Thu, Oct 8, 2015 at 4:49 AM, Klaus Trainer <[email protected]> wrote:
> Hi Jamie! > > Checking CORS settings is always a good idea in such context ;) > > Have you checked that the `credentials` configuration in the `cors` > section (see > > http://docs.couchdb.org/en/latest/config/http.html?highlight=cors#cors/credentials > ) > is set to `true`? > > Also note that you need to set the `withCredentials` property on the > XMLHttpRequest object to `true` as well. > > Cheers, > Klaus > > > On 10/06/2015 04:19 AM, Jamie Diprose wrote: > > Hi > > > > I'm trying to get the session data using the CouchDB jQuery API from a > web > > application, but the userCtx.name variable is always null. The web > > application runs on a different port to CouchDB. > > > > Authentication with couchdb via Javascript is working fine; I'm using > > the CouchDB-XO_Auth > > plugin <https://github.com/ocastalabs/CouchDB-XO_Auth>. Once the user is > > logged in via the CouchDB-XO_auth plugin, they show up as logged in when > > requesting the session: http://127.0.0.1:5984/_session/ > > > > > {"ok":true,"userCtx":{"name":"awesomeuser","roles":[]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"],"authenticated":"cookie"}} > > > > > > But if I request the session from my web application I get the following > > data: > > > > > {"ok":true,"userCtx":{"name":"null","roles":["_admin"]},"info":{"authentication_db":"_users","authentication_handlers":["oauth","cookie","default"],"authenticated":"default"}} > > > > > > Does anyone have any ideas what could be going wrong? E.g. some cors > > related settings that stops you from being able to grab the session > cookie > > from another domain? > > > > Thanks for your help > > > > Jamie > > >
