Skip to content

Instantly share code, notes, and snippets.

@marshallswain
Created April 6, 2017 20:57
Show Gist options
  • Save marshallswain/3e4e63eeb479e2927b62a8729f748602 to your computer and use it in GitHub Desktop.
Save marshallswain/3e4e63eeb479e2927b62a8729f748602 to your computer and use it in GitHub Desktop.
Example FeathersJS authentication.js setup with `jwt` and `local` authentication
'use strict';
const authentication = require('feathers-authentication');
const jwt = require('feathers-authentication-jwt');
const local = require('feathers-authentication-local');
module.exports = function() {
const app = this;
const config = app.get('authentication');
app.configure(authentication(config));
app.configure(jwt());
app.configure(local());
app.service('authentication').hooks({
before: {
create: [
authentication.hooks.authenticate(config.strategies)
],
remove: [
authentication.hooks.authenticate('jwt')
]
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment