{"id":18136,"library":"auth-strategy-manager","title":"Auth Strategy Manager","description":"Meta package for auth-strategy-manager that installs the core package by default. Version 2.0.2 ships bundled TypeScript types, supports Node.js and browser environments with ESM and CJS exports. It provides a unified strategy-based authentication and authorization abstraction layer, simplifying integration of multiple auth providers (e.g., JWT, OAuth, API keys) behind a consistent interface. Key differentiators include zero-config core setup via the meta package, first-class TypeScript support, and a plugin-style strategy architecture that avoids runtime dependencies beyond the core.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/azarov-serge/auth-strategy-manager","tags":["javascript","authentication","authorization","strategy","auth","core","typescript"],"install":[{"cmd":"npm install auth-strategy-manager","lang":"bash","label":"npm"},{"cmd":"yarn add auth-strategy-manager","lang":"bash","label":"yarn"},{"cmd":"pnpm add auth-strategy-manager","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Meta package delegates all functionality to the core library; installed automatically.","package":"@auth-strategy-manager/core","optional":false}],"imports":[{"note":"Meta package installs core; importing the meta package triggers side effects only. Use core for explicit members.","symbol":"","correct":"import 'auth-strategy-manager'"},{"note":"Named exports are from the core package, not the meta package. The meta package has no default export.","wrong":"import { AuthStrategyManager } from 'auth-strategy-manager'","symbol":"AuthStrategyManager","correct":"import { AuthStrategyManager } from '@auth-strategy-manager/core'"},{"note":"Package is ESM-only since v2. CommonJS require() will fail with dynamic import() required for CJS environments.","wrong":"const { Strategy } = require('@auth-strategy-manager/core')","symbol":"Strategy","correct":"import { Strategy } from '@auth-strategy-manager/core'"}],"quickstart":{"code":"import { AuthStrategyManager } from '@auth-strategy-manager/core';\n\nconst manager = new AuthStrategyManager();\n\n// Define a simple JWT strategy\nmanager.use('jwt', {\n  type: 'jwt',\n  secret: process.env.JWT_SECRET ?? 'fallback-secret',\n  verify: async (token) => {\n    // verify logic\n    return { userId: '123' };\n  }\n});\n\n// Authenticate a request\nasync function authenticate(token: string) {\n  const result = await manager.authenticate('jwt', token);\n  if (result.success) {\n    console.log('User:', result.payload);\n  } else {\n    console.error('Auth failed:', result.error);\n  }\n}\n\nauthenticate('some-token');","lang":"typescript","description":"Initializes the Auth Strategy Manager, registers a JWT strategy with secret from environment variable, and authenticates a token."},"warnings":[{"fix":"Replace 'auth-manager-core' with '@auth-strategy-manager/core' in imports and package.json dependencies.","message":"v2.0.0 renamed package from 'auth-manager-core' to '@auth-strategy-manager/core'. All imports must be updated.","severity":"breaking","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use import syntax. For CJS environments, use dynamic import: const { AuthStrategyManager } = await import('@auth-strategy-manager/core');","message":"v2.0.0 dropped support for CommonJS (require). Package is ESM-only. Requires Node >=14 or bundler support.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Replace 'algorithm: 'HS256'' with 'algorithms: ['HS256']'.","message":"v1.x strategy options with 'algorithm' property are deprecated in v2. Use 'algorithms' array instead.","severity":"deprecated","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Import directly from '@auth-strategy-manager/core' for any symbols.","message":"The meta package 'auth-strategy-manager' is a side-effects-only package; it does not export any symbols. Attempting to import named exports from it will fail.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install @auth-strategy-manager/core","cause":"Missing dependency: need to install @auth-strategy-manager/core separately or ensure meta package installs it correctly.","error":"Cannot find module '@auth-strategy-manager/core' or its corresponding type declarations."},{"fix":"Ensure you import AuthStrategyManager from '@auth-strategy-manager/core', not from 'auth-strategy-manager'.","cause":"Attempting to call .use() on an improperly initialized manager (e.g., using default import from meta package instead of core).","error":"TypeError: authStrategyManager.use is not a function"},{"fix":"Use import statement or dynamic import: const { AuthStrategyManager } = await import('@auth-strategy-manager/core');","cause":"Using require() to import an ESM-only package.","error":"ERR_REQUIRE_ESM: require() of ES Module not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}