jsonwebtoken plugin for Egg.js.
NOTE: This plugin just for integrate jsonwebtoken into Egg.js, more documentation please visit node-jsonwebtoken.
$ npm i --save egg-easy-jwt
config/plugin.js
exports.jwt = {
enable: true,
package: 'egg-easy-jwt'
}
// controller.js or service.js
const token = await this.ctx.jwt.sign({
a: 1,
b: 2
}, "secret");
const verify = await this.ctx.jwt.verify(token, "secret");
const decode = this.ctx.jwt.decode(token);
more example please visit https://github.com/auth0/node-jsonwebtoken.