{"id":18137,"library":"auth-token-cookie","title":"auth-token-cookie","description":"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.","status":"deprecated","version":"0.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/senecajs/auth-token-cookie","tags":["javascript","seneca","auth","cookie"],"install":[{"cmd":"npm install auth-token-cookie","lang":"bash","label":"npm"},{"cmd":"yarn add auth-token-cookie","lang":"bash","label":"yarn"},{"cmd":"pnpm add auth-token-cookie","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin registers as a Seneca plugin and requires Seneca instance.","package":"seneca","optional":false}],"imports":[{"note":"Package is CJS-only; no ESM support. Use require() in Node.js.","wrong":"import authTokenCookie from 'auth-token-cookie'","symbol":"default (plugin)","correct":"const authTokenCookie = require('auth-token-cookie')"},{"note":"The plugin is registered by name string, not by importing the module directly (seneca-auth handles auto-load).","wrong":"seneca.use(require('auth-token-cookie').default)","symbol":"plugin registration","correct":"seneca.use('auth-token-cookie')"},{"note":"Configuration is passed via seneca-auth options, not directly to this plugin.","wrong":"seneca.use('auth-token-cookie', { cookieName: 'myapp_token' })","symbol":"options","correct":"seneca.use('auth', { token: { cookie: { name: 'myapp_token' } } })"}],"quickstart":{"code":"const Seneca = require('seneca')\nconst seneca = Seneca()\n\n// The auth-token-cookie plugin is auto-loaded by seneca-auth\nseneca.use('seneca-auth')\n\n// Configure auth token cookie\nseneca.use('auth', {\n  token: {\n    cookie: {\n      name: 'token',\n      secret: process.env.COOKIE_SECRET ?? ''\n    }\n  }\n})\n\n// Example: register an action that requires authentication\nseneca.add({ role: 'user', cmd: 'profile' }, function (msg, done) {\n  var user = this.context.msg$?.meta?.user\n  done(null, { user: user })\n})\n\n// Start listening (optional)\nseneca.listen({ type: 'http', port: 3000 })","lang":"javascript","description":"Shows how to use auth-token-cookie with seneca-auth: auto-load, configure cookie, and define an authenticated action."},"warnings":[{"fix":"Use seneca-auth's built-in cookie handling or a modern auth solution like @seneca/auth.","message":"auth-token-cookie is no longer maintained for Seneca 3.x+.","severity":"deprecated","affected_versions":">=0.0.5"},{"fix":"Upgrade to Seneca 3.x and use @seneca/auth with its own cookie plugin.","message":"Only compatible with Seneca 0.8–0.9 and Node.js 4–5.","severity":"breaking","affected_versions":"*"},{"fix":"Do not call seneca.use('auth-token-cookie') explicitly. It's loaded by seneca.use('auth').","message":"The plugin is auto-loaded by seneca-auth; manual registration is not required.","severity":"gotcha","affected_versions":"*"},{"fix":"Use require('auth-token-cookie') or import via createRequire.","message":"No ESM exports; only CommonJS require() works.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider alternatives like cookie-based JWT tokens with express or @fastify/cookie.","message":"The package has not been updated since 2016 and lacks modern security features.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure auth-token-cookie is in node_modules; it's usually installed as a dependency of seneca-auth.","cause":"The package is not installed as a direct dependency, but seneca-auth requires it.","error":"Error: Cannot find module 'auth-token-cookie'"},{"fix":"Use require() instead of import.","cause":"Using ES module import syntax for a CJS-only package.","error":"TypeError: seneca.use is not a function"},{"fix":"Remove the explicit use() call.","cause":"Manually calling seneca.use('auth-token-cookie') when it is auto-loaded by seneca-auth.","error":"Error: Plugin 'auth-token-cookie' is already registered"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}