Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-auth

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-auth

Node.js package for HTTP basic and digest access authentication.

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
191K
decreased by-54.9%
Maintainers
1
Weekly downloads
 
Created

What is http-auth?

The http-auth npm package provides basic and digest access authentication for Node.js applications. It allows developers to secure their web applications by requiring users to provide a username and password before accessing certain routes or resources.

What are http-auth's main functionalities?

Basic Authentication

This feature allows you to set up basic authentication for your Node.js server. Users will need to provide a username and password to access the protected routes.

const http = require('http');
const auth = require('http-auth');

const basic = auth.basic({
  realm: 'Simon Area',
  file: __dirname + '/users.htpasswd' // user:password in htpasswd format
});

http.createServer(basic, (req, res) => {
  res.end(`Welcome to private area - ${req.user}!`);
}).listen(1337, () => {
  console.log('Server running at http://127.0.0.1:1337/');
});

Digest Authentication

This feature allows you to set up digest authentication for your Node.js server. Digest authentication is more secure than basic authentication as it uses MD5 hashing.

const http = require('http');
const auth = require('http-auth');

const digest = auth.digest({
  realm: 'Simon Area',
  file: __dirname + '/users.htdigest' // user:realm:password in htdigest format
});

http.createServer(digest, (req, res) => {
  res.end(`Welcome to private area - ${req.user}!`);
}).listen(1337, () => {
  console.log('Server running at http://127.0.0.1:1337/');
});

Other packages similar to http-auth

Keywords

FAQs

Package last updated on 02 Feb 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