A jwt middleware for Koa
MIT License
A jwt middleware for Koa
npm install @sqrtthree/koa-jwt
import * as Koa from 'koa'
import { jwtMiddleware } from '@sqrtthree/koa-jwt'
const app = new Koa()
app.use(
jwtMiddleware({
subject: 'identity_authentication',
})
)
string
Target subject of jwt.
?string
Target issuer of jwt.
?string | (tokenPayload) => Promise<string>
A string or function containing either the secret for HMAC algorithms.
?string
Attribute name extended to ctx.state
, the value is jwt payload. It will be jwtPayload
by default.
sqrtthree.com · GitHub @sqrthree · Twitter @sqrtthree