Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default (plugin)
✓ const authTokenCookie = require('auth-token-cookie')
✗ import authTokenCookie from 'auth-token-cookie'
Package is CJS-only; no ESM support. Use require() in Node.js.
plugin registration
✓ seneca.use('auth-token-cookie')
✗ seneca.use(require('auth-token-cookie').default)
The plugin is registered by name string, not by importing the module directly (seneca-auth handles auto-load).
options
✓ seneca.use('auth', { token: { cookie: { name: 'myapp_token' } } })
✗ seneca.use('auth-token-cookie', { cookieName: 'myapp_token' })
Configuration is passed via seneca-auth options, not directly to this plugin.
Shows how to use auth-token-cookie with seneca-auth: auto-load, configure cookie, and define an authenticated action.
const Seneca = require('seneca')
const seneca = Seneca()
// The auth-token-cookie plugin is auto-loaded by seneca-auth
seneca.use('seneca-auth')
// Configure auth token cookie
seneca.use('auth', {
token: {
cookie: {
name: 'token',
secret: process.env.COOKIE_SECRET ?? ''
}
}
})
// Example: register an action that requires authentication
seneca.add({ role: 'user', cmd: 'profile' }, function (msg, done) {
var user = this.context.msg$?.meta?.user
done(null, { user: user })
})
// Start listening (optional)
seneca.listen({ type: 'http', port: 3000 })
Errors
Common errors & fixes
Error: Cannot find module 'auth-token-cookie'
The package is not installed as a direct dependency, but seneca-auth requires it.
fixEnsure auth-token-cookie is in node_modules; it's usually installed as a dependency of seneca-auth.
TypeError: seneca.use is not a function
Using ES module import syntax for a CJS-only package.
fixUse require() instead of import.
Error: Plugin 'auth-token-cookie' is already registered
Manually calling seneca.use('auth-token-cookie') when it is auto-loaded by seneca-auth.
fixRemove the explicit use() call.
Audit
Dependencies
senecarequiredPeer dependency; the plugin registers as a Seneca plugin and requires Seneca instance.