0.1.1 • Published 5 years ago

microauth-token v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

microauth-token

Token auth wrapper for zeit/micro

Unfortunately not all third-parties are able or willing to add the Authorization header to a request, especially with webhooks. However, it's possible to add a token to the query string and use that for authorizing requests.

Install

With npm installed, run

$ npm install microauth-token

Usage

With a micro project:

// index.js
const auth = require('microauth-token')

module.exports = auth('TOKEN')((req, res) => {
  res.end('Authorized')
})
$ TOKEN=abc micro
$ curl localhost:3000?TOKEN=abc # => '200 Authorized'
$ curl localhost:3000?TOKEN=xyz # => '401 Unauthorized'

License

MIT

0.1.1

5 years ago

0.1.0

6 years ago