egg-multi-jwt
v2.0.2
Published
Egg's JWT authentication plugin which supports multiple JWT.
Downloads
6
Maintainers
Readme
egg-multi-jwt
Egg's JWT authentication plugin which supports multiple JWT.
Install
$ npm i -S egg-multi-jwt
Usage
Enable it with:
// {app_root}/config/plugin.js
exports['multi-jwt'] = {
enable: true,
package: 'egg-multi-jwt',
};
Read example in test/fixtures/apps/multi-jwt-test/ for more details.
How To Create A Token
// suppose 'admin' is the key of one jwt
const token = app['multi-jwt']('admin').sign({ foo: 'bar' }, app.config['multi-jwt'].admin.secret);