Nourished Personal Mucus

    express-user-auth

    1.4.0 • Public • Published

    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:





    Keywords

    none

    Install

    npm i express-user-auth

    DownloadsWeekly Downloads

    18

    Version

    1.4.0

    License

    MIT

    Unpacked Size

    426 kB

    Total Files

    25

    Last publish

    Collaborators

    • will123195