Code Monkey home page Code Monkey logo

Comments (3)

DeathHound6 avatar DeathHound6 commented on June 12, 2024 1

I've done some debugging with breakpoints on the internal code, comparing the sessions both from my own implemented functions and the strategy success complete function located internally in lib/middleware/authenticate.js, and I can see that upon logging in, it is generating a completely different session object.

I've tested this using:

  • express version 4.18.2
  • express-session version 1.17.3
  • memorystore version 1.6.7
  • passport version 0.6.0
  • passport-local version 1.0.0
    Windows 10 OS, Node.JS V16.3.0, NPM V9.4.0

Changing the value of the session option saveUninitialized does not make any difference to this issue

from passport.

rafikchb avatar rafikchb commented on June 12, 2024 1

The solution is to pass the option keepSessionInfo: true to the authenticate method.

from passport.

CapCap avatar CapCap commented on June 12, 2024

Same problem- was able to workaround it with the following

router.get('/auth/google/callback',
  async (req, res, next) => {
    const redirectUrl: string = (req.session as any).afterLogin;
    await passport.authenticate('google', {})(req, res, next);
    res.redirect(redirectUrl);
    next();
  });

from passport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.