JWT (JSON Web Token) Session Middleware for Koa
Barebone JWT based session for Koa 2. Tests and configurable options comming soon.
The API is exposed on the context object (this
) inside downstream middlewares.
Getting started
;;const app = ;app; // Generate a Session from a controller (route handler) { const formFields = await // store session const data = ctxJWTSession;} // Validating a session from a controller (route handler) { const authed = ctxJWTSession; if authed // Do something that requires auth else // Handle error
API
- generate(payload)
- get()
- set()
- clear()
- authed()