Skip to content

User returned in isAuthenticated always null #276

Closed Answered by sergiodxa
jcjp asked this question in Q&A
Discussion options

You must be logged in to vote

The user data can be anything, I store a token for example, but ensure that you're using the authenticator.sessionKey, otherwise authenticator.isAuthenticated will not be able to find the user data.

The Session is basically an object, and if you do session.set("key1", "data") that will mean your session is now this

{ "key1": "data" }

If you then try to do session.get("key2") it won't find data because it's a different key, if you don't use authenticator.sessionKey to save the user data (your string) then the next time you call authenticator.isAuthenticated it will try to use a different key and not find your data.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sergiodxa
Comment options

Answer selected by jcjp
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants