Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.18 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.18 KB

express-jwt-sign

jwt signature generator for express

Installation

$ npm install --save express-jwt-sign

Usage

const express = require('express');
const jwtsign = require('express-jwt-sign');
const appId = 'fe/star';
const appSecret = 'xxx';    // 这两个参数需要保密

const app = express();
app.use(jwtsign(appId, appSecret, {
    pathPattern: /\/star\/evaluations\//,   // ignore to generate jwt signature on all requests
    expireInSeconds: 60,                    // default to 1 hour
});

app.use(function (req, res, next) {
    console.log(req.__jwtsignature);
});

License

MIT © wangshijun