82563

$.couch.session returns userctx with null name

I'm calling the following code:

$.couch.login($.extend({ name: "harry", password: "secrets"}, callback)); $.couch.session(callback);

where "harry" is just a dummy user I created using $.couch.signup and callback is a simple object specifying success/error/complete functions with bodies like these:

success: function (data) { console.log('Success'); console.log(data); }

This code returns the following:

Success Object {ok: true, name: "harry", roles: Array[0]} Success Object {ok: true, userCtx: Object, info: Object}

The first return is fine, but the second, the one from session, the userCtx object is basically empty, with a null name.

Also, when I try to login using my personal username and password (the ones I use as a Futon admin), this is returned:

Success Object {ok: true, name: null, roles: Array[1]} (0: "_admin") Success Object {ok: true, userCtx: Object, info: Object}

and fascinatingly, the first request knows seems to know I'm an admin, but doesn't get any other data, and the second request does the same thing as the previous example.

Any thoughts? Am I not using $.couch.session correctly? Is there something wrong with my couch instance?

FYI I am using version 1.4.0 and built from source.

Answer1:

It turns out all I really needed was an apache reverse proxy. The couch instance didn't have access to the AuthSession cookie, since it was coming from port 5984. Now things work great with the following added to my apache2.conf (may be httpd.conf for some)

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so ProxyPass /_couch http://localhost:5984 nocanon ProxyPassReverse /_couch http://localhost:5984

Recommend

  • Attemping to change attributes of $(this) inside success function
  • How to add regEx in angular filter
  • Can't access Tomcat 7 Manager app when running from Eclipse
  • insert a picture into database(sqlite) with java code. what should i do?
  • How to synchronize two scrollview in Android?
  • Is it better to have roles as a column on my users table, or do it through join tables (Roles &
  • Using android opencv apps without downloading opencv sdk manager
  • Google OAuth: can't get refresh token with authorization code
  • Add reference to ASP.NET 5 Class Library from Framework 4.5 Class Library Project
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • JSON encode and decode on PHP
  • Building Qt project for C++11 standard
  • IE11 throwing “SCRIPT1014: invalid character” where all other browsers work
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Detect when Facebook like button is clicked
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Get data from AJAX - How to
  • How to rebase a series of branches?
  • Bug in WPF DataGrid
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • Rearranging Cells in UITableView Bug & Saving Changes
  • How to pass list parameters for each object using Spring MVC?
  • AT Commands to Send SMS not working in Windows 8.1
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • AngularJs get employee from factory
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Proper way to use connect-multiparty with express.js?
  • Benchmarking RAM performance - UWP and C#
  • Angular 2 constructor injection vs direct access
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • Is it possible to post an object from jquery to bottle.py?
  • EntityFramework adding new object to nested object collection
  • sending mail using smtp is too slow
  • Busy indicator not showing up in wpf window [duplicate]
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can I use `wmic` in a Windows PE script?