DEV Community

Discussion on: Authentication and Sessions for MVC Apps with NestJS

Collapse
ffirsching profile image
Felix Firsching

Hey John, awesome article! I hope you keep them coming! I struggle specifically with setting a default strategy with passport? I tried setting it in the module import via "PassportModule.register({ defaultStrategy: 'jwt' })," in both, once the AppModule and once my AuthModule, but it doesn't seem to work?

When setting the guard via decorator it works no problem? Hope you can point me in the right direction, cheers!

Collapse
johnbiundo profile image
John Biundo Author

Hi Felix, thanks for the feedback!

So, have you looked at the code sample here: docs.nestjs.com/techniques/authent... and does your code follow that pattern? You should only need to do this in the AuthModule if this is where you are registering Passport. If so, and this still isn't working, and you have a public repo, I'd be happy to take a look. Good luck!