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

Cannot set property 'user' of undefined #5

Open
TroutNemesis opened this issue Mar 14, 2017 · 6 comments
Open

Cannot set property 'user' of undefined #5

TroutNemesis opened this issue Mar 14, 2017 · 6 comments

Comments

@TroutNemesis
Copy link

TypeError: Cannot set property 'user' of undefined at /Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/hooks/passport/index.js:160:31 at pass (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:267:43) at serialized (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:276:7) at /Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/hooks/passport/index.js:66:6 at pass (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:284:9) at Authenticator.serializeUser (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:289:5) at req.login.req.logIn (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/hooks/passport/index.js:155:26) at afterVerifyingCredentials (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/responses/login.js:119:10) at Strategy.strategy.success (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/middleware/authenticate.js:201:18) at verified (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport-local/lib/strategy.js:83:10) at /Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/responses/login.js:93:12

I get the above error whenever I try to login. I haven't meddled with the hook you wrote. Any ideas on what might be causing this?

@sgress454
Copy link

Hm, that is curious. It looks like the Passport session isn't being initialized. Are you using the default (memory) session store?

@TroutNemesis
Copy link
Author

Idk I followed the tutorial/copied the repo pretty exactly. Where does one set the type of memory session?

@alinvdu
Copy link

alinvdu commented Apr 10, 2017

I also get this error regarding _passport.session being undefined. I guess session store should be enabled by default thus session initialization should work. But it doesn't, does anyone know why?

@chrislbennett
Copy link

Did anyone figure out a solution to this issue? I'm running into the same thing and not making any headway on it ...

@elipeters
Copy link

res.login in the UserController is not constructed properly - commented out are 2 examples of how to properly pass the required User, Object and callback Function to passport/index.js.

In UserController.js CHANGE
login: function (req, res) { return res.login({ successRedirect: '/' }); },

TO
login: function (req, res) { return req.login({user: req.params.all()}, function(err){ if(err) return res.notFound(null, 'user/signup'); return res.view('/'); }); },

@hasnainelahi
Copy link

I need Help 👍
Unhandled rejection TypeError: Cannot set property 'user' of undefined

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

No branches or pull requests

6 participants