Express authentication system
Sign-up, login and protected routes for a Node.js app, using JSON Web Tokens and hashed passwords on MongoDB.
- Type
- API
- Status
- Open source
- Built with
- Node.js, Express, MongoDB, Mongoose, JWT, bcrypt
- Links
- View the code
What it is
The login layer most web apps need: user registration and login, passwords hashed with bcrypt, JWT tokens issued on login, and middleware that protects private routes.
Endpoints
POST /api/auth/registercreates an accountPOST /api/auth/loginreturns a tokenGET /api/users/mereturns the signed-in user, for valid tokens only