feathers-authentication
Add Authentication to your FeathersJS app.
feathers-authentication
adds shared PassportJS authentication for Feathers HTTP REST and WebSockets services using JSON Web Tokens.
Installation
npm install feathers-authentication --save
Documentation
Please refer to the Authentication documentation for more details:
- Local Auth Tutorial - How to implement a username and password-based authentication.
- Use Hooks for Authorization - Learn about the bundled hooks.
Complete Example
Here'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.
;;;;;;; const port = 3030;const Schema = mongooseSchema;const UserSchema = email: type: String required: true unique: true password: type: String required: true createdAt: type: Date 'default': Datenow updatedAt: type: Date 'default': Datenow;let UserModel = mongoose; mongoosePromise = globalPromise;mongoose; let app = // Configure feathers-authentication ; app let userService = app;userService; let server = app;server;
Client use
You can use the client in the Browser, in NodeJS and in React Native.
;;;;;; const socket = ;const app = // you could use Primus or REST instead ; app;
License
Copyright (c) 2016
Licensed under the MIT license.