https://github.com/zhangmingfeng/egg-easy-jwt
jwt(jsonwebtoken) plugin for Egg.js
https://github.com/zhangmingfeng/egg-easy-jwt
egg egg-plugin jsonwebtoken jwt
Last synced: 6 months ago
JSON representation
jwt(jsonwebtoken) plugin for Egg.js
- Host: GitHub
- URL: https://github.com/zhangmingfeng/egg-easy-jwt
- Owner: zhangmingfeng
- License: mit
- Created: 2018-10-15T09:47:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-05T00:51:45.000Z (about 6 years ago)
- Last Synced: 2024-11-20T22:20:50.491Z (7 months ago)
- Topics: egg, egg-plugin, jsonwebtoken, jwt
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# egg-easy-jwt
jsonwebtoken plugin for Egg.js.> NOTE: This plugin just for integrate jsonwebtoken into Egg.js, more documentation please visit [node-jsonwebtoken](https://github.com/auth0/node-jsonwebtoken).
# Install
```bash
$ npm i --save egg-easy-jwt
```## Usage & configuration
- `config/plugin.js`
``` js
exports.jwt = {
enable: true,
package: 'egg-easy-jwt'
}
```### example
```js
// 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.