You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this code, accessing req.user return undifined.
Sadly, adding this line req.user = user
after //Authentication successful
won't work.
However, adding req.session.user = user works !
In addition, without the custom callback, req.user is correctly set.
I think I've pointed out an unexpected behavior, or maybe I'm doing something wrong.
Regards
The text was updated successfully, but these errors were encountered:
I think it is related to the fact that you are using a custom callback without using the req.login method, not to whether you're using Express 3 or 4.
From the docs, "Note that when using a custom callback, it becomes the application's responsibility to establish a session (by calling req.login()) and send a response."
You should add this code if your authentication is successful :
Hi,
I've been struggling to user req.user using a custom callback for authenticate.
The code i'm using is the following:
With this code, accessing req.user return undifined.
Sadly, adding this line
req.user = user
after
//Authentication successful
won't work.
However, adding
req.session.user = user
works !In addition, without the custom callback, req.user is correctly set.
I think I've pointed out an unexpected behavior, or maybe I'm doing something wrong.
Regards
The text was updated successfully, but these errors were encountered: