1.0.0 • Published 7 years ago

@xlnt/micro-api-auth v1.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
7 years ago

🚸 micro-api-auth

A super simple way of adding api key authorization to your zeit/micro microservice.

import withApiAuth from '@xlnt/micro-api-auth'

export default withApiAuth()(myMicroFunction)

withApiAuth also allows for some configuration like

getValidApiKeys: () => string[]
// pulls from process.env.API_KEYS (json encoded) by default

getApiKey: (req: IncomingMessage) => string
// pulls from req.headers['Authorization'] in the `Bearer :token` format by default

that's it.