0.1.1 • Published 7 years ago

koa-session-jwt v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

koa-session-jwt

a middleware that stores session data in a jwt token

NPM Version

Install

npm i -S koa-session-jwt

or

yarn add koa-session-jwt

Usage

import session from "koa-session-jwt"
import Koa from 'koa'
const app = new Koa();

app.use(session("secret!"));

app.use(async (ctx, next)=>{
    if(ctx.session.bar === "foo")
        ctx.session.foo = "bar";
    next()
})

Options

secret string required - the secret string used to sign the jwt

opts object optional - all the options available for jsonwebtoken plus cookie (default jwt-session) that is the name of the cookie used to store the jwt on clients

License

MIT