Created
April 6, 2017 20:57
-
-
Save marshallswain/3e4e63eeb479e2927b62a8729f748602 to your computer and use it in GitHub Desktop.
Example FeathersJS authentication.js setup with `jwt` and `local` authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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