-
Notifications
You must be signed in to change notification settings - Fork 55
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
Bugfix: Issue #181 #187
base: main
Are you sure you want to change the base?
Bugfix: Issue #181 #187
Conversation
Add dummy req.session.regenerate and req.session.save for passport 0.6.0
Hi, thanks for the PR. I am honestly a bit torn. I'd rather see a fix in upstream One of my main concerns is, that after adding this, a bugfix release in An alternative would be to rely on a workaround outside of app.use(cookieSession({
// ...
}))
// register regenerate & save after the cookieSession middleware initialization
app.use(function(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()
}) As suggested in jaredhanson/passport#904 (comment) |
Only add dummy regenerate and save methods if they do not already exist
Thanks for the response! I made the change you suggested, and feel a bit silly that I didn't do that to begin with 😅. I definitely see what you mean about an upstream fix being better, and this not being a perfect solution by any means! Up to you if you want to merge this, but its here if you do :) |
Thanks for the update! I'll collect some feedback in #181 to get an idea how urgent a workaround in |
@rkusa I think it would be better if you fix this issue in Koa-passport and release it asap, we are consuming koa-passport in many of our code packages. Please let us know the timeline. |
koa-session v6.4.0 was just released, with my PR linked above merged (koajs/session#221). This solves the issue without any workarounds needed. |
Add dummy req.session.regenerate and req.session.save, which passport 0.6.0 expects the request object to have.
Not entirely sure if this is in line with the philosophy of this library, but it fixed the issue for me, and I tried to match the style of the existing code!
Let me know what you think :)