Skip to content
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

Simplified Passport/Passport-Local Configuration #46

Open
FCimendere opened this issue May 3, 2024 · 0 comments
Open

Simplified Passport/Passport-Local Configuration #46

FCimendere opened this issue May 3, 2024 · 0 comments

Comments

@FCimendere
Copy link

FCimendere commented May 3, 2024

Hello @Colt

For the app.js file while we are using authentication over passport there is an update.

Starting from version 0.2.1, passport-local-mongoose adds a helper method createStrategy as static method to your schema. The createStrategy is responsible to setup passport-local LocalStrategy with the correct options. Bacuse of this no need to define LocalStrategy and using this lines of code : passport.use(new LocalStrategy(User.authenticate()));

We could update this lines as below:

const User = require('./models/user');

// CHANGE: USE "createStrategy" INSTEAD OF "authenticate"
passport.use(User.createStrategy());

@FCimendere FCimendere reopened this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant