https://github.com/trekjs/jwt
JSON Web Tokens middleware
https://github.com/trekjs/jwt
Last synced: about 1 month ago
JSON representation
JSON Web Tokens middleware
- Host: GitHub
- URL: https://github.com/trekjs/jwt
- Owner: trekjs
- License: mit
- Created: 2016-11-24T08:48:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-07T12:15:36.000Z (over 7 years ago)
- Last Synced: 2025-04-22T04:08:28.270Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 145 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trek-jwt
JSON Web Tokens Middleware for Trek.js
## Installation
```
$ npm install trek-jwt --save
```## Examples
```js
'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
```js
const defaults = {
key: 'user',
secret: undefined,
skip: false,
tokenLookup: 'header:Authorization',
authScheme: 'Bearer',
verifyOptions: undefined,
passthrough: false
}
```## Badges
[](https://travis-ci.org/trekjs/jwt)
[](https://codecov.io/gh/trekjs/jwt)
---
> [fundon.me](https://fundon.me) ·
> GitHub [@fundon](https://github.com/fundon) ·
> Twitter [@_fundon](https://twitter.com/_fundon)