Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/will123195/express-user-auth
Simple User Registration and Login for your Express app
https://github.com/will123195/express-user-auth
Last synced: 3 days ago
JSON representation
Simple User Registration and Login for your Express app
- Host: GitHub
- URL: https://github.com/will123195/express-user-auth
- Owner: will123195
- Created: 2017-03-02T03:40:25.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T05:58:29.000Z (almost 2 years ago)
- Last Synced: 2024-04-30T04:04:43.120Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 984 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# express-user-auth
Quickly add user authentication to your Express app
- Works with any database
- Password hash stored using bcrypt
- Password reset functionality
- TODO: Login with Facebook, Twitter, Google, or Github## Install
```
npm i express express-user-auth
```## Requirements
Your `createUser` and `updateUser` methods must be able to save the following fields:
- `passwordHash`
- `passwordAlgo`
- `passwordResetToken`## Usage
```js
import express from 'express'
import auth from 'express-user-auth'
const app = express()
// all functions are async and should return a Promise
app.use('/', auth({
sessionSecret: 'XXXX',
jwtSecret: 'XXXX',
createUser: function (user) { return user },
getUserByUsername: function (username) { return user },
updateUser: function (data) { return user },
sendPasswordReset: function ({ user, uri }) { },
passwordResetRedirectURL: '/'
}))app.listen(3000)
```## Routes
`express-user-auth` creates the following routes:
- `GET /register`
- `GET /login`
- `GET /forgot-password`
- `GET /reset-password`- `POST /register`
- `POST /login`
- `POST /send-password-reset`
- `POST /reset-password`## Screenshots
You get this UI out of the box: