jwt signature generator for express
$ npm install --save express-jwt-sign
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);
});
MIT © wangshijun