Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

I'm a newbie to node.js so there's a good chance i'm missing something. ... #274

Closed
wants to merge 1 commit into from

3 participants

@ebaizel

... but it seems like the loggedIn flag is not on the req object directly but on req.session.auth Please verify this. If you look at line 140 in index.js you'll see that it also uses req.session.auth

@ebaizel ebaizel I'm a newbie to node.js so there's a good chance i'm missing somethin…
…g. but it seems like the loggedIn flag is not on the req object directly but on req.session.auth Please verify this. If you look at line 140 in index.js you'll see that it also uses req.session.auth
78db535
@thisissami

are you using Connect? If so, I think that the new version of connect screwed things up. I've been really frustrated over the past couple days with a similar/same issue (essentially never being able to verify if somebody is logged in or not using any of the described functions). I was so frustrated that I switched to PassPort JS, and now I'm having the same issues there. I think this will work fine with either Express or older versions of Connect, but not entirely sure (since I haven't verified).

@thisissami

if you're using cluster, that could be the problem. that was the problem for me. to quote somebody on PassportJS:

"Quick reply: are you using cluster or spinning up multiple server instances?

If so, the built-in MemoryStore for the session won't work properly, and you need to switch to something like this:
https://github.com/visionmedia/connect-redis

Or one of the other session stores listed here:
https://github.com/senchalabs/connect/wiki

The reason is that you'll end up hitting a server which didn't serve the original request, and thus doesn't have that session information in its own memory. That sounds like what could be going on if deserializeUser isn't called 100% of the time."

@bnoguchi bnoguchi closed this in e04500d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 6, 2012
  1. @ebaizel

    I'm a newbie to node.js so there's a good chance i'm missing somethin…

    ebaizel authored
    …g. but it seems like the loggedIn flag is not on the req object directly but on req.session.auth Please verify this. If you look at line 140 in index.js you'll see that it also uses req.session.auth
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  README.md
View
2  README.md
@@ -265,7 +265,7 @@ of helpers given previously, the alternative leveraging userAlias would look lik
`everyauth` also provides convenience methods on the `ServerRequest` instance `req`.
From any scope that has access to `req`, you get the following convenience getters and methods:
-- `req.loggedIn` - a Boolean getter that tells you if the request is by a logged in user
+- `req.session.auth.loggedIn` - a Boolean getter that tells you if the request is by a logged in user
- `req.user` - the User document associated with the session
- `req.logout()` - clears the sesion of your auth data
Something went wrong with that request. Please try again.