Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including htpasswd-auth with all npm packages installed. Try it out:

var htpasswdAuth = require("htpasswd-auth")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

htpasswd-auth v2.0.1

authenticate with htpasswd files

htpasswd-auth Circle CI

read/write htpasswd files


npm install --save htpasswd-auth

Checking if a password is valid

var htpasswd = require('htpasswd-auth');
var file     = fs.readFileSync('./path-to-htpasswd', 'utf-8');

htpasswd.authenticate('dickeyxxx', 'pass', file)
.then(function (auth) {
  // auth is true if the password is valid


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free