{"library":"seneca-local-auth","title":"seneca-local-auth","description":"Local authentication plugin for Seneca.js, providing local strategy support via PassportJS. Current stable version 0.1.2. This plugin is designed to be used with seneca-auth and Seneca toolkit. It handles username/password authentication, session management, and user registration. Tested on Seneca 0.8 and 0.9, Node 4 and 5. Key differentiator: integrates seamlessly with seneca-auth's plugin architecture and message patterns for authentication.","language":"javascript","status":"maintenance","last_verified":"Sat Apr 25","install":{"commands":["npm install seneca-local-auth"],"cli":null},"imports":["require('seneca-local-auth')","require('seneca')()\n  .use('auth')\n  .use('local-auth', options)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const Seneca = require('seneca');\nconst seneca = Seneca();\n\nseneca.use('auth', {\n  redirect: {\n    login: '/login',\n    register: '/register'\n  }\n});\n\nseneca.use('local-auth', {\n  login: {\n    fields: ['username', 'password']\n  },\n  register: {\n    fields: ['username', 'password'],\n    confirm: true\n  }\n});\n\nseneca.act('role:auth, cmd:register', {\n  username: 'admin',\n  password: process.env.PASSWORD || 'secret'\n}, (err, user) => {\n  if (err) console.error(err);\n  else console.log('User registered');\n});\n\nseneca.act('role:auth, cmd:login', {\n  username: 'admin',\n  password: process.env.PASSWORD || 'secret'\n}, (err, login) => {\n  if (err) console.error(err);\n  else console.log('Login successful', login);\n});","lang":"javascript","description":"Demonstrates how to set up and use local authentication with seneca-auth and seneca-local-auth, including user registration and login.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}