New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-user-auth

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-user-auth

Simple user authentication for your Express app

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

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:





FAQs

Package last updated on 29 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc