Registry / security / propro-auth-middleware

propro-auth-middleware

JSON →
library1.3.6jsnpmunverified

Propro-auth-middleware is a Node.js authentication middleware for Express supporting server-side and client-side authentication with lazy loading, environment validation, and customizable options. Version 1.3.6 is the latest stable release. It is designed for applications needing robust authentication strategies. Differentiating features include dual-mode support and configuration flexibility, though it has a small user base and limited adoption compared to alternatives like Passport.js.

npm install propro-auth-middleware
INSTALL
IMPORT
SIG · PROPRO-AUTH-MIDDLE
P
propro-auth-middleware
securityjavascriptv1.3.6
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
const proproAuthMiddleware = require('propro-auth-middleware');
import proproAuthMiddleware from 'propro-auth-middleware';
Package uses CommonJS and has no default export for ES modules.
proproAuthMiddleware
const proproAuthMiddleware = require('propro-auth-middleware');
const { proproAuthMiddleware } = require('propro-auth-middleware');
The module exports a single function directly, not as a named export.
proproAuthMiddleware
const proproAuth = require('propro-auth-middleware');
const auth = require('propro-auth-middleware').default;
There is no .default property; the require returns the function directly.

Express app with server-side authentication using custom validation and redirect on failure.

const express = require('express'); const proproAuthMiddleware = require('propro-auth-middleware'); const app = express(); const authOptions = { useServerAuth: true, serverOptions: { secret: process.env.SECRET || 'default_secret', authUrl: process.env.AUTH_URL || '', clientId: process.env.CLIENT_ID || '', clientSecret: process.env.CLIENT_SECRET || '', clientUrl: process.env.CLIENT_URL || '', redirectUri: process.env.REDIRECT_URI || '', onAuthFailRedirect: '/login', validateUser: async (userId) => { return userId === 'admin'; }, additionalChecks: async (req) => { return true; }, }, useClientAuth: false, }; app.use(proproAuthMiddleware(authOptions)); app.get('/', (req, res) => { res.send('Authenticated!'); }); app.listen(3000, () => console.log('Server running on port 3000'));
Debug
Known issues
gotchaMiddleware may fail silently if required environment variables (AUTH_URL, CLIENT_ID, CLIENT_SECRET) are not set.
fix
Ensure all required env vars are defined before initializing middleware.
affects: >=1.0.0
gotchaThe module uses CommonJS only; ES module import syntax will not work.
fix
Use require() instead of import statements.
affects: >=1.0.0
deprecatedPassing boolean arguments (e.g., proproAuthMiddleware(true, false)) is outdated; use options object instead.
fix
Use an object parameter: proproAuthMiddleware({ useServerAuth: true, useClientAuth: false }).
affects: >=1.1.0
gotchaThe 'secret' option defaults to 'RESTFULAPIs' which is insecure and may be overridden by environment variables.
fix
Explicitly set a strong secret via options or environment variable.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'propro-auth-middleware'
Package not installed or not in node_modules.
fix
Run 'npm install propro-auth-middleware' and ensure package.json includes it.
TypeError: proproAuthMiddleware is not a function
Incorrect import syntax; likely using ES module import.
fix
Use require('propro-auth-middleware') instead of import.
ReferenceError: SECRET is not defined
Environment variable not set or misspelled.
fix
Set SECRET in process.env or pass explicitly in options.
Upgrade
Version history
1.3.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
propro-auth-middleware — npm install propro-auth-middleware · libregistry