Verdaccio Htpasswd Authentication Plugin

10.5.5 · active · verified Wed Apr 22

verdaccio-htpasswd is the official and default authentication plugin for Verdaccio, a lightweight private npm proxy registry. It enables user authentication by leveraging standard Apache `htpasswd` files, making it a simple yet effective solution for managing access to private packages. The package is currently at version 10.5.5 and is actively maintained as part of the Verdaccio monorepo, receiving updates in alignment with Verdaccio's release cycle (e.g., it was updated alongside Verdaccio 5.24.0). Its primary differentiator is its seamless, built-in integration with Verdaccio, offering file-based user management, support for various hashing algorithms including bcrypt, MD5, SHA1, and crypt, and an easy configuration process. It's ideal for private registries where a full-fledged database-backed authentication system is overkill, providing a straightforward approach to user registration and login.

Common errors

Warnings

Install

Imports

Quickstart

This configuration snippet for `config.yaml` enables `verdaccio-htpasswd` as the authentication backend, specifies the path to the htpasswd file, sets the hashing algorithm to bcrypt with 10 rounds, and defines package access permissions based on authentication status.

auth:
  htpasswd:
    file: ./htpasswd
    # Maximum amount of users allowed to register, defaults to "+infinity".
    # Set to -1 to disable registration via `npm adduser`.
    # max_users: 1000
    # Hash algorithm, possible options are: "bcrypt", "md5", "sha1", "crypt".
    # Default algorithm is crypt, but 'bcrypt' is recommended for new installations.
    algorithm: bcrypt
    # Rounds number for "bcrypt", ignored for other algorithms.
    # Setting this higher increases security but also CPU usage during verification.
    rounds: 10

# Example package access configuration using htpasswd authentication
packages:
  '@*/*':
    access: $authenticated # Only authenticated users can access scoped packages
    publish: $authenticated # Only authenticated users can publish scoped packages
  '**':
    access: $all          # All users (including anonymous) can access public packages
    publish: $authenticated # Only authenticated users can publish public packages

view raw JSON →