Every reload of the '/search' requires the user to log-in again
sashamitrovich opened this issue · comments
This happens with MarkLogic 9.0-3.1
That has been bothering me a lot since 9.0-3 too! I have been digging in, and I think I found the culprit. It goes wrong at the initial call to /api/user/status after a browser reload. At that point the middle-tier is initialized, and authenticator is prepared. Unfortunately, the route for /api/user/status passes in the wrong path to calculate the auth header, so it gets rejected by ML since 9.0-3.
This and following line:
needs to be replaced with:
var passportUser = req.session.passport.user;
var path = '/v1/documents?uri=/api/users/' + passportUser.username + '.json';
After that it all runs as before!
Verified, the fix works on ML 9.0-3.1!
(This really helps preventing insanity from constant logging in, thanks!)