egg-easy-jwt

1.0.1 • Public • Published

egg-easy-jwt

jsonwebtoken plugin for Egg.js.

NOTE: This plugin just for integrate jsonwebtoken into Egg.js, more documentation please visit node-jsonwebtoken.

Install

$ npm i --save egg-easy-jwt

Usage & configuration

  • config/plugin.js
exports.jwt = {
  enable: true,
  package: 'egg-easy-jwt'
}

example

// 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.

Package Sidebar

Install

npm i egg-easy-jwt

Weekly Downloads

20

Version

1.0.1

License

MIT

Unpacked Size

4.22 kB

Total Files

9

Last publish

Collaborators

  • zhangmingfeng