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
Passport's logIn() function is not called #7
Comments
Yes I ran into the same issue, the documentation is quite young but I did manage to get it working, and here is a tutorial on it: NestJS Basic Auth and Sessions Tutorial |
Call Passport's logIn() function to set and persist user to the request Fixes issue nestjs#7 Passport's logIn() function is not called
Hey guys, will this fix be merged into the master branch? |
See Inheritance section https://docs.nestjs.com/techniques/authentication |
I'm confused by the Inheritance section you refer to, @kamilmysliwiec. In that section, you have a code comment that reads:
But As well, there's a sample app for this section (https://github.com/nestjs/nest/tree/master/sample/19-auth/src) which has a Assuming that the Finally, I imported it as a provider in the .module.ts file, and then, in my controller, replaced the ...Although I'm getting issues in my Google strategy now, so we'll see what's up there... It's running my Strategy's Edit: Whoops; I realized it wasn't crashing, just throwing a console.log because serializeUser didn't have a User yet. Anyway, I successfully got the Google OAuth2 page, clicked it and got a profile back (which I've been able to do since yesterday), but it's still not an active session. When I go back to a page that requires auth, it still has no user in |
Hallo,
when using the guard to protect the login-route, the user is correctly set at the request-object when the user passes the right credentials (I am using the LocalStrategy). So I though, everything would be alright...
but the user is not persisted to the session.
By debugging I found out that the AuthGuard doesn't call Passport's logIn()-function and therefore the user is only set to the request, but not persisted to the session. I believe this is quite an unexpected behavior for most users because it is different to the default way that Passport works.
In my opinion this should either be fixed or at least documented.
The text was updated successfully, but these errors were encountered: