![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
feathers-authentication
Advanced tools
Add Authentication to your FeathersJS app.
feathers-authentication
adds shared PassportJS authentication for Feathers HTTP REST and WebSockets services using JSON Web Tokens.
npm install feathers-authentication --save
Please refer to the Authentication documentation for more details:
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.
import feathers from 'feathers';
import hooks from 'feathers-hooks';
import bodyParser from 'body-parser';
import authentication from 'feathers-authentication';
import { hooks as authHooks } from 'feathers-authentication';
import mongoose from 'mongoose';
import service from 'feathers-mongoose';
const port = 3030;
const Schema = mongoose.Schema;
const UserSchema = new Schema({
email: {type: String, required: true, unique: true},
password: {type: String, required: true },
createdAt: {type: Date, 'default': Date.now},
updatedAt: {type: Date, 'default': Date.now}
});
let UserModel = mongoose.model('User', UserSchema);
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost:27017/feathers');
let app = feathers()
.configure(feathers.rest())
.configure(feathers.socketio())
.configure(hooks())
.use(bodyParser.json())
.use(bodyParser.urlencoded({ extended: true }))
// Configure feathers-authentication
.configure(authentication());
app.use('/users', new service('user', {Model: UserModel}))
let userService = app.service('users');
userService.before({
create: [authHooks.hashPassword('password')]
});
let server = app.listen(port);
server.on('listening', function() {
console.log(`Feathers application started on localhost:${port}`);
});
You can use the client in the Browser, in NodeJS and in React Native.
import io from 'socket.io-client';
import feathers from 'feathers/client';
import hooks from 'feathers-hooks';
import socketio from 'feathers-socketio/client';
import localstorage from 'feathers-localstorage';
import authentication from 'feathers-authentication/client';
const socket = io('http://localhost:3030/');
const app = feathers()
.configure(socketio(socket)) // you could use Primus or REST instead
.configure(hooks())
.configure(authentication({ storage: window.localStorage }));
app.authenticate({
type: 'local',
'email': 'admin@feathersjs.com',
'password': 'admin'
}).then(function(result){
console.log('Authenticated!', result);
}).catch(function(error){
console.error('Error authenticating!', error);
});
Copyright (c) 2016
Licensed under the MIT license.
FAQs
Add Authentication to your FeathersJS app.
The npm package feathers-authentication receives a total of 56 weekly downloads. As such, feathers-authentication popularity was classified as not popular.
We found that feathers-authentication demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.