Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.65 KB

File metadata and controls

53 lines (36 loc) · 1.65 KB

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.