Registry / auth-security / auth-express

auth-express

JSON →
library0.0.62jsnpmunverified

A middleware library for Express.js that provides a unified authentication box supporting multiple strategies (JWT, OAuth, session, etc.). Current stable version 0.0.62 (as of 2025) with minimal release cadence (no recent updates). Key differentiator: single-box configuration for auth, but lacks documentation and appears unmaintained. Alternatives like passport or express-jwt are more robust.

npm install auth-express
INSTALL
IMPORT
SIG · AUTH-EXPRESS
A
auth-express
auth-securityjavascriptv0.0.62
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import auth from 'auth-express'
const auth = require('auth-express')
The package is ESM-only since v0.0.50. CommonJS require will fail.
Auth
import { Auth } from 'auth-express'
Named export available; use for custom configuration.
verifyToken
import { verifyToken } from 'auth-express'
const { verifyToken } = require('auth-express')
CommonJS destructuring is not supported; use ESM import.

Initializes auth middleware with JWT secret and protects a route using auth.required guard.

import express from 'express'; import auth from 'auth-express'; const app = express(); app.use(auth({ secret: process.env.JWT_SECRET ?? 'default-secret' })); app.get('/protected', auth.required, (req, res) => { res.json({ user: req.user }); }); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
deprecatedauth-express is no longer maintained. Use passport or express-jwt instead.
fix
Migrate to a maintained authentication library.
affects: >=0.0.0
breakingVersion 0.0.60 dropped support for CommonJS (require). Only ESM imports are allowed.
fix
Use ES module syntax: import auth from 'auth-express'
affects: >=0.0.60
gotchaThe default export is a factory function, not middleware directly. Must call it with options first.
fix
Use app.use(auth(options)) instead of app.use(auth)
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'auth-express'
Package not installed or not in node_modules.
fix
Run npm install auth-express
TypeError: Cannot read properties of undefined (reading 'secret')
Missing required options object when calling auth().
fix
Provide options: auth({ secret: 'mysecret' })
SyntaxError: The requested module 'auth-express' does not provide an export named 'default'
Using CommonJS require() on an ESM-only module.
fix
Switch to import statement: import auth from 'auth-express'
Upgrade
Version history
0.0.62latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources
auth-express — npm install auth-express · libregistry