{"id":25150,"library":"cubic-auth","title":"cubic-auth","description":"Simple OAuth2 authentication server for the Cubic framework (v3.2.3). Provides JWT-based access and refresh tokens using RS256 signing by default. Integrates with cubic-api and cubic-core to verify users stored in the auth database. Key differentiators: built specifically for Cubic's ecosystem, supports cookie-based auth for web clients, and manages user logs. Not intended as a standalone auth server outside Cubic.","status":"active","version":"3.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/cubic-js/cubic","tags":["javascript"],"install":[{"cmd":"npm install cubic-auth","lang":"bash","label":"npm"},{"cmd":"yarn add cubic-auth","lang":"bash","label":"yarn"},{"cmd":"pnpm add cubic-auth","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for API integration","package":"cubic-api","optional":false}],"imports":[{"note":"CommonJS only; no ESM support in v3.2.3.","wrong":"const Auth = require('cubic-auth').default","symbol":"Auth","correct":"const Auth = require('cubic-auth')"},{"note":"Must be used as a plugin with Cubic instance.","wrong":"import { Auth } from 'cubic-auth'","symbol":"options","correct":"const cubic = new Cubic(); cubic.use(new Auth({ exp: '2h', alg: 'RS256' }))"},{"note":"Option key is 'certPrivate' not 'privateKey'.","wrong":"new Auth({ privateKey: '...' })","symbol":"certPrivate","correct":"new Auth({ certPrivate: '...', certPublic: '...' })"}],"quickstart":{"code":"const Cubic = require('cubic')\nconst Auth = require('cubic-auth')\n\nconst cubic = new Cubic()\ncubic.use(new Auth({\n  api: { server: { port: 3030 } },\n  core: { server: { port: 2020 } }\n}))\n\ncubic.on('nodestarted', () => {\n  console.log('Auth server running on port 3030')\n})","lang":"javascript","description":"Initializes a Cubic auth server with custom API and core ports using CommonJS require."},"warnings":[{"fix":"Update cubic-api to v3.0.0 or later.","message":"cubic-auth v3 requires cubic-api >=3.0.0. Older versions are incompatible.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Provide valid RSA key strings for 'certPrivate' and 'certPublic' in production.","message":"The 'certPrivate' and 'certPublic' options must be provided as strings. In dev mode they are auto-generated; in production they are required.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Ensure 'api' and 'core' options are plain objects with valid sub-options like 'server.port'.","message":"Options 'api' and 'core' can override internal nodes but must be objects; misconfiguration can prevent server startup.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use valid ms string (e.g., '1h', '30m') for 'exp'.","message":"The 'exp' option uses string format like '1h', not milliseconds. Invalid formats will cause token issuance to fail silently.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install cubic-auth' and ensure it's in node_modules.","cause":"Package not installed or wrong version.","error":"Error: Cannot find module 'cubic-auth'"},{"fix":"Use 'const cubic = new Cubic()' before calling 'cubic.use()'.","cause":"Cubic instance not created correctly.","error":"TypeError: cubic.use is not a function"},{"fix":"Set 'certPrivate' and 'certPublic' options with valid RSA key strings.","cause":"Running outside dev mode without providing RSA keys.","error":"Error: certPrivate option is required in production mode"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}