Add custom authentication to your data
npm i feathers-authentication-hooks-apikey
TBD
Here's an example hook adding authentication using feathers-authentication-hooks-apikey
.
const { addAuthentication } = require('feathers-authentication-hooks-apikey')
module.exports = {
before: {
find: [ addAuthentication({ secret: 'my-super-secret' }) ],
patch: [ addAuthentication({ secret: 'my-super-secret' }) ]
}
}
Here's an example hook checking authentication using feathers-authentication-hooks-apikey
.
const { authenticateFrom } = require('feathers-authentication-hooks-apikey')
module.exports = {
before: {
// if `required: false` it will not fail if the secret is not present
find: [ authenticateFrom({ path: 'params.query', secret: 'my-super-secret', required: false }) ]
patch: [ authenticateFrom({ path: 'data', secret: 'my-super-secret', required: true }) ]
}
}
Copyright (c) 2018
Licensed under the MIT license.