express-basicauth
A simple express middleware for basic authentication
How to install
Install with npm:
npm install --save express-basicauth
How to use with Express
This will authenticate if username entered is 'username' and password entered is 'password'.
var express = ;var basicAuth = ;var app = ; app;
Using a custom username and password:
var express = ;var basicAuth = ;var app = ; app;
You can also optionally provide your own custom athenticator.
var express = ;var basicAuth = ;var app = ; /** * All you need is a function which returns a promise that is resolved once authenticated. * You can also use async functions for this */ { let authenticated = false; // add authentication logic return authenticated ? Promise : Promise;} app;