At this point, I have one single file with multiple passport strategies for local and third-party authentication. I am now trying to refactor each Strategy to its own file but that throws a bunch of errors.
I tried this :
passport.use("local-signup", signupStrategy); //in the main file and
const signupStrategy = require('passport-local').Strategy({//function}); //in the other file
But this throws 'authentication strategies must have a name' Error.
How do I fix this?
This is how I abstract strategies into their own files. Also note that the strategy name given in
passport.use('local-signup')
must match the name inpassport.authenticate('local-signup')
on the route.main.js
localSignup.js