feathers-authentication-hooks-apikey
v0.0.2
Published
Add custom authentication to your data
Downloads
134
Readme
feathers-authentication-hooks-apikey
Add custom authentication to your data
Installation
npm i feathers-authentication-hooks-apikey
Documentation
TBD
Complete Example
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 }) ]
}
}
License
Copyright (c) 2018
Licensed under the MIT license.