brewery-auth-test
raw JSON → 1.2.20 verified Sat Apr 25 auth: no javascript maintenance
An authentication package built on PassportJs supporting login, signup, MFA, password reset, and profile management. Currently at version 1.2.20 with no recent updates; depends on Nexmo and Sendgrid accounts. Compared to PassportJs alone, it bundles database integration, token refresh, and SMS/email verification out of the box, but is narrowly scoped and not actively maintained.
Common errors
error TypeError: BreweryAuth is not a constructor ↓
cause Importing as named instead of default in CJS.
fix
Use const BreweryAuth = require('brewery-auth');
error Cannot find module 'brewery-auth' ↓
cause Package not installed or name misspelled.
fix
Run npm install brewery-auth-test and require as 'brewery-auth' (note: npm name is brewery-auth-test but require path is brewery-auth).
error Error: ENOENT: no such file or directory, open '...' ↓
cause Missing configuration file or environment variable.
fix
Ensure .env file exists and contains all required variables.
Warnings
deprecated Package has not been updated since 2021; may rely on outdated dependencies. ↓
fix Consider migrating to a maintained auth library like Passport.js directly or using Identity platforms.
gotcha BreweryAuth class requires all config properties; missing properties may cause silent failures. ↓
fix Ensure all environment variables are set or provide defaults.
breaking Version 1.2 changed the config structure; salt field added and tokenSecret renamed. ↓
fix Update config to include salt and use tokenSecret instead of previous secret key.
Install
npm install brewery-auth-test yarn add brewery-auth-test pnpm add brewery-auth-test Imports
- BreweryAuth wrong
import BreweryAuth from 'brewery-auth'correctconst BreweryAuth = require('brewery-auth') - BreweryAuth wrong
const BreweryAuth = require('brewery-auth')correctconst BreweryAuth = require('brewery-auth').default - BreweryAuth wrong
import { BreweryAuth } from 'brewery-auth'correctimport BreweryAuth from 'brewery-auth'
Quickstart
const BreweryAuth = require('brewery-auth');
const config = {
dbConfig: {
databaseName: process.env.DB_NAME ?? '',
username: process.env.DB_USERNAME ?? '',
password: process.env.DB_PASSWORD ?? '',
dialect: process.env.DB_DIALECT ?? '',
host: process.env.DB_HOST ?? ''
},
salt: process.env.SALT ?? '',
tokenSecret: process.env.ACCESS_TOKEN_SECRET ?? '',
refreshSecret: process.env.REFRESH_TOKEN_SECRET ?? '',
nexmoSecret: process.env.NEXMO_API_SECRET ?? '',
nexmoKey: process.env.NEXMO_API_KEY ?? '',
sendgridKey: process.env.SENDGRID_API_KEY ?? '',
senderEmail: process.env.SENDER_EMAIL ?? '',
senderSms: process.env.SENDER_SMS ?? ''
};
const auth = new BreweryAuth(config);
auth.login({ clientId: 'my-client', clientSecret: 'my-secret' })
.then(result => console.log(result))
.catch(err => console.error(err));