Hello, I wanna implement magic link authentification but I wasn't able to find one made specifically for nestjs. I found this one but it says for "passport.js" which is nodejs
https://www.npmjs.com/package/passport-magic-login
#Can a package made for nodejs be used for nestjs ?
6 messages · Page 1 of 1 (latest)
Hi, yes, you can use any node.js library freely.
With this library you're probably in luck, since Nest.js has a library for working with Passport: https://docs.nestjs.com/security/authentication
You can follow the guide up to a point where the passport local strategy is used: https://docs.nestjs.com/security/authentication#implementing-passport-local
That's where you should by able to plug in the magic-login strategy you found:
import MagicLoginStrategy from "passport-magic-login"
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Thank you very much
I mean, you'll probably have to follow both readme of the lib and the nest.js docs completely and mix and match it together, but you get the point 🙂
the nestjs doc explains how to implement passport-local which is for a usernam/password authentication mechanism. I'm not sure to understand, is there something that I should take from it ?
The nestjs/passport package has some helpers to integrate packages from passport ecosystem to nestjs.
The local strategy is for username/password, the magic link is just other of many strategies, but the flow and integration should be similar