0.0.2 • Published 6 years ago

feathers-authentication-hooks-apikey v0.0.2

Weekly downloads
23
License
MIT
Repository
github
Last release
6 years ago

feathers-authentication-hooks-apikey

Build Status Code Climate Test Coverage

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.