Socket
Socket
Sign inDemoInstall

@jackyhweng/egg-jwt

Package Overview
Dependencies
17
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jackyhweng/egg-jwt

egg jwt2 plugin for egg


Version published
Maintainers
1
Created

Readme

Source

egg-jwt

NPM version build status Test coverage npm

Deepexi Egg's JWT(JSON Web Token Authentication Plugin)

Install

$ npm i @jackyhweng/egg-jwt --save

Usage

// {app_root}/config/plugin.js
exports.jwt = {
  enable: true,
  package: "@jackyhweng/egg-jwt"
};

Configuration

// {app_root}/config/config.default.js
'use strict';
exports.jwt = {
  enable: true,
  // match和ignore不能同时使用
  match: ['/*']
};

see config/config.default.js for more detail.

Example

// app/router.js
"use strict";

module.exports = app => {
  app.get('/test',app.controller.test.index);
};
// app/controller/test.js
("use strict");

module.exports = app => {
  class SuccessController extends app.Controller {
    index() {
         console.log('query body : ', this.ctx.query);
         this.ctx.body = this.ctx.query;
    }
  }
  return SuccessController;
};

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Last updated on 20 Aug 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc