User management service
This package provides some utilities for user management from the express route down to the mongoose data layer.
How to use
It's quite simple, just do:
; const unless = path: url: /\/signup/ url: /\/login/ ; mongoosePromise = Promise; const app = ;app;app;
The options required are:
- secret: some string secret used to encode and decode the tokens
- app: the express app
- mongoose: the mongoose object used on your project
- unless: the endpoints you don't want to be authenticated
In case you want the login and signup to be in different sub-endpoints:
const unless = path: url: /\/your\/endpoint\/signup/ url: /\/your\/endpoint\/login/ ; app;
Implementation details
This package saves the users in an users
collection on mongodb, requiring the
fields username
, password
and email
and accepting a role
field.
We don't implement anything related to ACLs, so you can use your own implementation or use some third party library.
TODO
- Implement Facebook login
- Implement Google login
- Recover password