https://github.com/mattchewone/feathers-authentication-hooks-apikey
Add custom authentication for server to server communication
https://github.com/mattchewone/feathers-authentication-hooks-apikey
Last synced: 2 months ago
JSON representation
Add custom authentication for server to server communication
- Host: GitHub
- URL: https://github.com/mattchewone/feathers-authentication-hooks-apikey
- Owner: Mattchewone
- License: mit
- Created: 2018-03-06T21:49:04.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T17:49:35.000Z (about 7 years ago)
- Last Synced: 2025-02-23T20:22:09.872Z (3 months ago)
- Language: JavaScript
- Size: 65.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# feathers-authentication-hooks-apikey
[](https://travis-ci.org/Mattchewone/feathers-authentication-hooks-apikey)
[](https://codeclimate.com/github/Mattchewone/feathers-authentication-hooks-apikey)
[](https://codeclimate.com/github/Mattchewone/feathers-authentication-hooks-apikey/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`.
```js
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`.
```js
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](LICENSE).