🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@amdglobal/koa-bearer-token

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amdglobal/koa-bearer-token

Bearer token parser middleware for koa

Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

koa-bearer-token

NPM version Build Status Quality Test coverage Dependency Status

Bearer token parser middleware for koa

Inspired by express-bearer-token

Compatibility table

koa versionkoa-bearer-token version
<20.x.x
21.x.x

Install

$ npm install koa-bearer-token

Usage

Use with koa-bodyparser

const Koa = require('koa')
const bodyParser = require('koa-bodyparser');
const bearerToken = require('koa-bearer-token')

const app = new Koa()

app.use(bodyParser())
app.use(bearerToken())

app.use(function (ctx) {
  // ctx.request.token
})

app.listen(3000)

Provide in header

Authorization: Bearer <token>

Provide in query

?access_token=<token>

Provide in body

access_token=<token>

Customize

app.use(bearerToken({
  bodyKey: 'access_token',
  queryKey: 'access_token',
  headerKey: 'Bearer',
  reqKey: 'token'
}))

License

MIT © C. T. Lin

Keywords

koa

FAQs

Package last updated on 25 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts