Using feathers-authentication it is possible to authenticate a user using a configurable username field. At the moment, I can configure authentication to use either the username
OR email
fields of my user model, but I would like to offer both options username
AND email
to our users.
What would be the best way of doing this?
Apparently, it is possible to concatenate authentication methods so the solution should be something like:
app.configure(auth({ secret: 'super secret' }))
.configure(local()) // defaults usernameField to 'email'
.configure(local({ // support username
name: 'local-username',
usernameField: 'username'
}));
A more complete example can be found on GitHub: https://github.com/jaredhanson/passport-local/pull/148#issuecomment-261506180