-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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.session.regenerate is not a function since upgrade to 0.6.0 #907
Comments
What are you using for session middleware? |
cookie-session 2.0.0 |
Thanks for the report. This is a duplicate of #904. I'd recommend pinning to 0.5.x, until I've had a chance to release an update with the new features described on the initial issue. |
passport 0.6.0 jaredhanson/passport#907 이슈로 다운그레이드
Upstream link: jaredhanson/passport#907 Signed-off-by: Andrei Stepanov <astepano@redhat.com>
Upstream link: jaredhanson/passport#907 Signed-off-by: Andrei Stepanov <astepano@redhat.com>
Passport 0.5.0 has a significant vulnerability, and when we update to 0.6.0, we see the error "TypeError: req.session.regenerate is not a function." Does that mean that anything relating to the session create issue needs to be manually edited? |
Any update for March 2023? I see that @VottonDev has a fix in their separate repo.. |
Yeah, I'm using: https://github.com/joeyguerra/passport#missing-regenerate-on-req temporarily till passport fixes it upstream and that works for me so far when using the cookie-session module. |
@VottonDev, what's the best way to apply the fix in joeyguerra's fork? |
Well I've changed my package.json passport to The PR for the fix is here, which is how I found it: |
I am getting the below error when I logout from my application. I am using express-session module to manage the sessions. According to the above discussion is there a permanent fix for this or do I need to downgrade from Passport 0.6.0 /node_modules/passport/lib/sessionmanager.js:83 |
Hi All, Can anyone please confirm the status of this issue as this is currently blocking one of our production deployments? Is there a permanent fix for this or do we need to downgrade to 0.5.x version? |
I encountered a similar problem with version 0.6 of Passport. To resolve it, I downgraded to version 0.5.0 |
I ended up resolving this issue for our upgrade to passport 0.6.0 by stubbing the options = options || {};
+ this._delegate = options.delegate || {
+ regenerate: function(req, cb) {
+ cb();
+ },
+ save: function(req, cb) {
+ cb();
+ }
+ }; And then propagating those changes to the various calls to |
@imartinezmorales-loom do we simply have to add these lines or have to change/remove something as well |
@recursiveway - I actually ended up writing a middleware function that I pull into our express server. The middleware function is just a stub similar to the one above: export const passportMiddleware = (request, response, next) => {
if (request.session && !request.session.regenerate) {
request.session.regenerate = cb => {
cb();
};
}
if (request.session && !request.session.save) {
request.session.save = cb => {
cb();
};
}
next();
};
|
… details... /* Addressing issue with latest version of passport dependency packge TypeError: req.session.regenerate is not a function Reference: jaredhanson/passport#907 (comment) */
instead of using |
@tonmoydeb404 but they serve different purposes, it's not a solution. |
Can't believe this still isn't fixed? |
+1 Above |
Yes but it should also work with |
So should I change session manager from |
@drebel, it shows me, Error: req#logout requires a callback function |
Any news for this one? I'm getting same error under passport 0.7.0 and cookie-session 2.1.0 |
Hey, the cookie-session isn't officialy supported by passport. So I don't think they will ever make support for it. I used to use cookie-session, but I switched to express-session and it works very well. I suggest you to switch too. Have a nice day, |
Thanks for that! I will try to replace it |
express-session does not store cookies on the client side, the session gets destroyed every time the serve restarts, this is not a solution. |
With express jwt you can store the coockie as http only, I have it working now. |
Thanks for your suggestion |
The solution for this is making a database to save user sessions, for example really simple is SQLite. |
Вы смогли решить данную проблему? |
What is the status here? I'm running into the same issue ... and no, I don't want to store session data on server side. Would info from maintainer whether this is going to be fixed or remains unsolved. |
We have been using passport for some time within our application and have had no issues but once upgraded from 0.5.2 to 0.6.0 we are suddenly seeing an error when submitting authentication.
Our passport-authentication.js just initialises passport within expressJS and sets some local strategies.
I have rolled back to 0.5.3 and our application works fine again.
Environment
The text was updated successfully, but these errors were encountered: