Registry / auth-security / auth-token-cookie

auth-token-cookie

JSON →
library0.0.5jsnpmunverified

Seneca.js internal plugin for persisting authentication tokens in cookies. Version 0.0.5 is the latest stable release (last published 2016). This module is auto-loaded by seneca-auth and requires Seneca 0.8–0.9. It is not maintained for modern Seneca versions (3.x+). Key differentiator: minimal configuration, designed as a drop-in for seneca-auth's cookie-based token storage.

npm install auth-token-cookie
INSTALL
IMPORT
SIG · AUTH-TOKEN-COOKIE
A
auth-token-cookie
auth-securityjavascriptv0.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 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 })
Debug
Known issues
deprecatedauth-token-cookie is no longer maintained for Seneca 3.x+.
fix
Use seneca-auth's built-in cookie handling or a modern auth solution like @seneca/auth.
affects: >=0.0.5
breakingOnly compatible with Seneca 0.8–0.9 and Node.js 4–5.
fix
Upgrade to Seneca 3.x and use @seneca/auth with its own cookie plugin.
affects: *
gotchaThe plugin is auto-loaded by seneca-auth; manual registration is not required.
fix
Do not call seneca.use('auth-token-cookie') explicitly. It's loaded by seneca.use('auth').
affects: *
gotchaNo ESM exports; only CommonJS require() works.
fix
Use require('auth-token-cookie') or import via createRequire.
affects: *
deprecatedThe package has not been updated since 2016 and lacks modern security features.
fix
Consider alternatives like cookie-based JWT tokens with express or @fastify/cookie.
affects: *
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.
fix
Ensure 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.
fix
Use 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.
fix
Remove the explicit use() call.
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
senecarequiredPeer dependency; the plugin registers as a Seneca plugin and requires Seneca instance.
Agent activity
40 hits · last 30 days
node
34
OpenAI (training)
1
Resources
auth-token-cookie — npm install auth-token-cookie · libregistry