{"_id":"@alanpog/feathers-authentication","_rev":"3-290f219a588f5c39753b5f73897891c1","name":"@alanpog/feathers-authentication","description":"Add Authentication to your FeathersJS app.","dist-tags":{"latest":"0.7.12"},"versions":{"0.7.12":{"name":"@alanpog/feathers-authentication","description":"Add Authentication to your FeathersJS app.","version":"0.7.12","homepage":"https://github.com/alanpog/feathers-authentication","main":"lib/","keywords":["feathers","feathers-plugin"],"license":"MIT","repository":{"type":"git","url":"git://github.com/alanpog/feathers-authentication.git"},"author":{"name":"Feathers contributors","email":"hello@feathersjs.com","url":"https://feathersjs.com"},"contributors":[],"bugs":{"url":"https://github.com/feathersjs/feathers-authentication/issues"},"engines":{"node":">= 0.12.0"},"scripts":{"start":"node example/app","prepublish":"npm run compile","publish":"git push origin && git push origin --tags","release:patch":"npm version patch && npm publish --access=public","release:minor":"npm version minor && npm publish","release:major":"npm version major && npm publish","compile":"rimraf lib/ && babel -d lib/ src/ && mkdir lib/public/ && cp src/public/* lib/public/","watch":"babel --watch -d lib/ src/","jshint":"jshint src/. test/. --config","mocha":"mocha --opts mocha.opts","test":"npm run compile && npm run jshint && npm run coverage && nsp check","coverage":"istanbul cover node_modules/mocha/bin/_mocha -- --opts mocha.opts"},"directories":{"lib":"lib"},"browser":{"./lib/index":"./lib/client/index"},"dependencies":{"bcryptjs":"^2.3.0","debug":"^2.2.0","feathers-errors":"^2.0.1","feathers-hooks":"^1.5.0","jsonwebtoken":"^5.4.0","lodash.isplainobject":"^4.0.4","passport":"^0.3.0","passport-local":"^1.0.0"},"devDependencies":{"babel-cli":"^6.1.18","babel-core":"^6.18.2","babel-plugin-add-module-exports":"^0.2.0","babel-preset-es2015":"^6.1.18","body-parser":"^1.9.0","chai":"^3.5.0","feathers":"^2.0.1","feathers-hooks":"^1.4.0","feathers-memory":"^0.8.0","feathers-primus":"^1.3.2","feathers-rest":"^1.2.2","feathers-socketio":"^1.3.2","istanbul":"^1.1.0-alpha.1","jshint":"^2.8.0","localstorage-memory":"^1.0.2","mocha":"^3.0.0","nsp":"^2.2.0","passport-facebook":"^2.1.0","passport-github":"^1.0.0","primus":"^5.0.1","primus-emitter":"^3.1.1","request":"^2.69.0","rimraf":"^2.5.4","sinon":"^1.17.3","sinon-chai":"^2.8.0","socket.io-client":"^1.1.0","ws":"^1.0.1","xmlhttprequest":"^1.6.0"},"gitHead":"213736d00cb8d5bcdef69591f8ac248b381d542c","_id":"@alanpog/feathers-authentication@0.7.12","_shasum":"5f33e2872681b66ad5634c119f4119ec45b21eea","_from":".","_npmVersion":"3.9.5","_nodeVersion":"6.9.1","_npmUser":{"name":"alanpog","email":"alanpog@gmail.com"},"dist":{"shasum":"5f33e2872681b66ad5634c119f4119ec45b21eea","tarball":"https://registry.npmjs.org/@alanpog/feathers-authentication/-/feathers-authentication-0.7.12.tgz","integrity":"sha512-se6tVkmuzRK8cSe2vvNVYVK3HG8KuJWlbTMEzdeRkj7uWAKNAuJ/2wrpgfTSb2vxbndxX2IwA1x+FqFZySIYNQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmWhQhaix1KP0R73KYu3QVkBVHKeO0zZPs2qVi3ZglBwIhAMhDWA6i27YzOaCg5A86a2n7v0TJZfY5mbl0bmt8/tIa"}]},"maintainers":[{"name":"alanpog","email":"alanpog@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/feathers-authentication-0.7.12.tgz_1478570955817_0.25957077252678573"}}},"readme":"# feathers-authentication\n\n[![Build Status](https://travis-ci.org/feathersjs/feathers-authentication.png?branch=master)](https://travis-ci.org/feathersjs/feathers-authentication)\n[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-authentication.png)](https://codeclimate.com/github/feathersjs/feathers-authentication)\n[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-authentication/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-authentication/coverage)\n[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-authentication.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-authentication)\n[![Download Status](https://img.shields.io/npm/dm/feathers-authentication.svg?style=flat-square)](https://www.npmjs.com/package/feathers-authentication)\n[![Slack Status](http://slack.feathersjs.com/badge.svg)](http://slack.feathersjs.com)\n\n> Add Authentication to your FeathersJS app.\n\n`feathers-authentication` adds shared [PassportJS](http://passportjs.org/) authentication for Feathers HTTP REST and WebSockets services using [JSON Web Tokens](http://jwt.io/).\n\n\n## Installation\n\n```\nnpm install feathers-authentication --save\n```\n\n## Documentation\n\nPlease refer to the [Authentication documentation](http://docs.feathersjs.com/authentication/readme.html) for more details:\n\n- [Local Auth Tutorial](http://docs.feathersjs.com/authentication/local.html) - How to implement a username and password-based authentication.\n- [Use Hooks for Authorization](http://docs.feathersjs.com/authorization/readme.html) - Learn about the bundled hooks.\n\n\n## Complete Example\n\nHere's an example of a Feathers server that uses `feathers-authentication` for local auth.  It includes a `users` service that uses `feathers-mongoose`.  *Note that it does NOT implement any authorization.*\n\n```js\nimport feathers from 'feathers';\nimport hooks from 'feathers-hooks';\nimport bodyParser from 'body-parser';\nimport authentication from 'feathers-authentication';\nimport { hooks as authHooks } from 'feathers-authentication';\nimport mongoose from 'mongoose';\nimport service from 'feathers-mongoose';\n\nconst port = 3030;\nconst Schema = mongoose.Schema;\nconst UserSchema = new Schema({\n  email: {type: String, required: true, unique: true},\n  password: {type: String, required: true },\n  createdAt: {type: Date, 'default': Date.now},\n  updatedAt: {type: Date, 'default': Date.now}\n});\nlet UserModel = mongoose.model('User', UserSchema);\n\nmongoose.Promise = global.Promise;\nmongoose.connect('mongodb://localhost:27017/feathers');\n\nlet app = feathers()\n  .configure(feathers.rest())\n  .configure(feathers.socketio())\n  .configure(hooks())\n  .use(bodyParser.json())\n  .use(bodyParser.urlencoded({ extended: true }))\n  // Configure feathers-authentication\n  .configure(authentication());\n\napp.use('/users', new service('user', {Model: UserModel}))\n\nlet userService = app.service('users');\nuserService.before({\n  create: [authHooks.hashPassword('password')]\n});\n\nlet server = app.listen(port);\nserver.on('listening', function() {\n  console.log(`Feathers application started on localhost:${port}`);\n});\n```\n\n## Client use\n\nYou can use the client in the Browser, in NodeJS and in React Native.\n\n```js\nimport io from 'socket.io-client';\nimport feathers from 'feathers/client';\nimport hooks from 'feathers-hooks';\nimport socketio from 'feathers-socketio/client';\nimport localstorage from 'feathers-localstorage';\nimport authentication from 'feathers-authentication/client';\n\nconst socket = io('http://localhost:3030/');\nconst app = feathers()\n  .configure(socketio(socket)) // you could use Primus or REST instead\n  .configure(hooks())\n  .configure(authentication({ storage: window.localStorage }));\n\napp.authenticate({\n  type: 'local',\n  'email': 'admin@feathersjs.com',\n  'password': 'admin'\n}).then(function(result){\n  console.log('Authenticated!', result);\n}).catch(function(error){\n  console.error('Error authenticating!', error);\n});\n```\n\n## License\n\nCopyright (c) 2016\n\nLicensed under the [MIT license](LICENSE).\n","maintainers":[{"name":"alanpog","email":"alanpog@gmail.com"}],"time":{"modified":"2022-06-12T14:27:26.196Z","created":"2016-11-08T02:09:16.026Z","0.7.12":"2016-11-08T02:09:16.026Z"},"homepage":"https://github.com/alanpog/feathers-authentication","keywords":["feathers","feathers-plugin"],"repository":{"type":"git","url":"git://github.com/alanpog/feathers-authentication.git"},"contributors":[],"author":{"name":"Feathers contributors","email":"hello@feathersjs.com","url":"https://feathersjs.com"},"bugs":{"url":"https://github.com/feathersjs/feathers-authentication/issues"},"license":"MIT","readmeFilename":"README.md"}