Open puzzledbytheweb opened 6 years ago
Hi there , in your model,
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const passportLocalMongoose = require('passport-local-mongoose');
const userSchema = new Schema({
...
});
userSchema.plugin(passportLocalMongoose, { usernameField: 'email' });
module.exports = mongoose.model('User', userSchema);```
Hello everyone!
I am trying to use this authentication method in a React app with an Express backend. When defining the local strategy I use the .createSession() static method.
LocalStrategy throws this error:
TypeError: LocalStrategy requires a verify callback
This is how I am calling it:
Moreover I can't understant where should I set the usernameField to 'email'
Is it like this?
User.createStrategy({ usernameField: 'email'})
I am a bit confused about this...
Thanks in advance!