passport-local-sequelize icon indicating copy to clipboard operation
passport-local-sequelize copied to clipboard

HOW DO I CREATE MULTIPLE CONFIG FOR SAME TABLE

Open codesharpdev opened this issue 3 years ago • 0 comments

I have 2 user admin and public users stored in the same table

i want to log in to both users with different username fields.

how do I configure with admin-strategy?

I have tried Folwing code but no luck:

For admin LocalStrategySequelize.attachToUser(db.user, { usernameField: "email", hashField: "hash", saltField: "salt", });

For user LocalStrategySequelize.attachToUser(db.user, { usernameField: "contactNumber", hashField: "hash", saltField: "salt", });

passport.use(db.user.createStrategy()); passport.use("admin-strategy", db.user.createStrategy());

codesharpdev avatar Jul 03 '21 03:07 codesharpdev