Registry / auth-security / cubic-auth

cubic-auth

JSON →
library3.2.3jsnpmunverified

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.

npm install cubic-auth
INSTALL
IMPORT
SIG · CUBIC-AUTH
C
cubic-auth
auth-securityjavascriptv3.2.3
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.

Auth
✓ const Auth = require('cubic-auth')
✗ const Auth = require('cubic-auth').default
CommonJS only; no ESM support in v3.2.3.
options
✓ const cubic = new Cubic(); cubic.use(new Auth({ exp: '2h', alg: 'RS256' }))
✗ import { Auth } from 'cubic-auth'
Must be used as a plugin with Cubic instance.
certPrivate
✓ new Auth({ certPrivate: '...', certPublic: '...' })
✗ new Auth({ privateKey: '...' })
Option key is 'certPrivate' not 'privateKey'.

Initializes a Cubic auth server with custom API and core ports using CommonJS require.

const Cubic = require('cubic') const Auth = require('cubic-auth') const cubic = new Cubic() cubic.use(new Auth({ api: { server: { port: 3030 } }, core: { server: { port: 2020 } } })) cubic.on('nodestarted', () => { console.log('Auth server running on port 3030') })
Debug
Known issues
breakingcubic-auth v3 requires cubic-api >=3.0.0. Older versions are incompatible.
fix
Update cubic-api to v3.0.0 or later.
affects: <3.0.0
deprecatedThe 'certPrivate' and 'certPublic' options must be provided as strings. In dev mode they are auto-generated; in production they are required.
fix
Provide valid RSA key strings for 'certPrivate' and 'certPublic' in production.
affects: >=3.0.0
gotchaOptions 'api' and 'core' can override internal nodes but must be objects; misconfiguration can prevent server startup.
fix
Ensure 'api' and 'core' options are plain objects with valid sub-options like 'server.port'.
affects: >=3.0.0
gotchaThe 'exp' option uses string format like '1h', not milliseconds. Invalid formats will cause token issuance to fail silently.
fix
Use valid ms string (e.g., '1h', '30m') for 'exp'.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cubic-auth'
Package not installed or wrong version.
fix
Run 'npm install cubic-auth' and ensure it's in node_modules.
TypeError: cubic.use is not a function
Cubic instance not created correctly.
fix
Use 'const cubic = new Cubic()' before calling 'cubic.use()'.
Error: certPrivate option is required in production mode
Running outside dev mode without providing RSA keys.
fix
Set 'certPrivate' and 'certPublic' options with valid RSA key strings.
Upgrade
Version history
3.2.3latest on npm
Audit
Dependencies
cubic-apirequiredpeer dependency required for API integration
Agent activity
12 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
cubic-auth — npm install cubic-auth · libregistry