Skip to content

trekjs/jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

540c375 · Dec 7, 2017

History

17 Commits
Nov 13, 2017
Dec 18, 2016
Feb 4, 2017
Feb 8, 2017
Sep 2, 2017
Dec 7, 2017
Oct 28, 2017
Dec 7, 2017

Repository files navigation

trek-jwt

JSON Web Tokens Middleware for Trek.js

Installation

$ npm install trek-jwt --save

Examples

'use strict'

const Engine = require('trek-engine')
const jwt = require('..')

async function start () {
  const app = new Engine()
  const secret = 'Trek Engine'

  app.use(jwt({ secret }))

  app.use(({ req, res }) => {
    res.body = req.body
  })

  app.on('error', (err, ctx) => {
    console.log(err)
  })

  app.run(3000)
}

start().catch(err => console.log(err))

API

const defaults = {
  key: 'user',
  secret: undefined,
  skip: false,
  tokenLookup: 'header:Authorization',
  authScheme: 'Bearer',
  verifyOptions: undefined,
  passthrough: false
}

Badges

Build Status codecov


fundon.me  ·  GitHub @fundon  ·  Twitter @_fundon

About

JSON Web Tokens middleware

Resources

License

Stars

Watchers

Forks

Packages

No packages published