Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req.logIn() never sets cookie-session in the latest version of passport(0.6.0) #965

Open
jatin-vl opened this issue Jan 19, 2023 · 2 comments

Comments

@jatin-vl
Copy link

Hi, I have an express route for email verification that should login the user

/**

  • Server accepts a token and logs user in.
    */

After successful business flow, In last I want the user to be automatically logs in to the application to access other endpoints but req.logIn never sets cookie-session-based session manager in the latest version of passport(0.6.0).

const xyzSession: IxyzSession = {
id: prospect.$id(),
email: prospect.email,
orgDomain: prospect.org_domain,
};

req.logIn(xyzSession, function (err) {
Logger.info(
'---------------------xyzSession creation initiated---------------------',
prospect.email,
);

            if (err) {
                return next(err);
            }

});

It works fine with passport 0.5.3 version, please let me know is there any work-around that can resolve this issue with passport(0.6.0), as passport(0.5.3) is vulnerable.

@PhelixTaken
Copy link

I have the same issue. When I call req.logIn, it saves the session into the session store, but it does not send the cookie to the client in production.

@chungtrannam
Copy link

The reason of missing the cookie-session is because:

In version 0.6.0, the req.login function is asynchronous, and the callback function returns after the request is finished.

To fix this issue, we need to wait for req.login promise and then return the result to the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants