Open
Description
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
Hi! Based on this thread fastify/help#382 it seems that fastify-passport package is stable and can help resolve the problem related to this issue nestjs/nest#5702 . While the workaround mentioned in issue works i believe this package could also help resolve the problem.
Describe the solution you'd like
Add support for fastify-passport package.
Teachability, documentation, adoption, migration strategy
none
What is the motivation / use case for changing the behavior?
none
Activity
fastify-passport
becomes stable, we'll add support for it in the@nestjs/passport
package. nestjs/nest#13711olawalejuwonm commentedon Jun 21, 2024
Any update on this please?
d6nn9 commentedon Sep 27, 2024
dfenerski commentedon Sep 28, 2024
The key issue is native support for passport's guards & strategies.
songkeys commentedon Sep 29, 2024
I'd like to help work on this.
But I found that:
fastify-passport
is a direct port frompassport
passport
is a peer dependency of@nest/passport
and the api was used in the codeHow do you think we should bring
fastify-passport
in without interupting express'spassport
? Maybe we should make them optional and let user to pass in the passport instance?SzymonGonet commentedon Oct 29, 2024
Originally posted by @kamilmysliwiec in #5702 (comment)
jadejr commentedon Jan 24, 2025
stable by what metric? They are currently at 3.x.
I was able to get the tests to pass on initial release of nestjs 11 via this hacked up patch. The createPassportContext bit is particularly gnarly and could likely be greatly simplified and the e2e tests probably shouldn't be done this way, but rather be split out. I just don't know yet how to do that.
EDIT: I also realized i'm calling the request decorated method for
authenticate
but the global one could probably be used instead.jhrncar commentedon Feb 3, 2025
I also would like to use Fastify, Nest.js and Passport together in my application, so really looking forward to this!
mainfraame commentedon Feb 6, 2025
i’ve used passport with fastify in nestjs before with saml2 and oauth2 strategies. @d6nn9 is correct in that a temporary workaround is possible by decorating mostly) the reply object with express methods.
mrsimonemms commentedon Feb 26, 2025
The original workaround doesn't work with
fastify-secure-session
if you need to persist session data to the callback URL as theonSend
hook isn't triggered. Replacingthis.raw.end()
withthis.send()
seems to fix that.Forceres commentedon May 23, 2025
Any updates?