1.1.4 • Published 5 years ago

jup-auth-handler v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

jup-auth-handler

jup-auth-handler is a promise-based Node.js auth handler for MySQL using ORM Sequelize. Provides basic auth functions

Installation

$ npm i jup-auth-handler --save

Usage

You can use both ES6 or ES5 syntax to use the package

$ import { auth, userControllers, runMigrations } from 'jup-auth-handler' //es6 syntax
// Or you can use es5 Syntax
$ const { auth, userControllers, runMigrations } = require('jup-auth-handler'); //es5 syntax

// in your main.js use following to run all the migrations once the server gets started
runMigrations();

// for ACL use
app.use(auth.setAccessControl()); // will protect routes as per permissions

// using for login
app.post('/login', auth.authenticateUser, userControllers.createUser);

//using for protected routes
app.post('/protected-route', auth.verifyUser, yourController)

Create a .env file in the root directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. and load it in Node enviroment

Required ENV variables

#update the variables values with actual ones
MYSQL_USER=root
MYSQL_PASSWORD=root
MYSQL_DATABASE=jupiter
MYSQL_HOST=local
MYSQL_PORT=3606
expiry_time = 36000 # jwt token expiry time in miliseconds
SECRET_KEY_JWT = xyz #your secret JWT key
NO_REPLY_EMAIL = adnanshuja3@gmail.com # your email
NO_REPLY_PASSWORD = yourpassword #to send email to user [password reset, signup etc]

Tests

$ npm run test // run tests in package directory
1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.34

5 years ago

1.1.33

5 years ago

1.1.32

5 years ago

1.1.31

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.83

5 years ago

1.0.82

5 years ago

1.0.833

5 years ago

1.0.832

5 years ago

1.0.834

5 years ago

1.0.831

5 years ago

1.0.80

5 years ago

1.0.79

5 years ago

1.0.78

5 years ago

1.0.77

5 years ago

1.0.76

5 years ago

1.0.75

5 years ago

1.0.73

5 years ago

1.0.72

5 years ago

1.0.71

5 years ago

1.0.70

5 years ago

1.0.69

5 years ago

1.0.68

5 years ago

1.0.66

5 years ago

1.0.67

5 years ago

1.0.65

5 years ago

1.0.6

5 years ago

1.0.62

5 years ago

1.0.61

5 years ago

1.0.64

5 years ago

1.0.63

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago