1.1.1 • Published 4 years ago

think-session-jwt v1.1.1

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

think-session-jwt

JsonWebToken to store session for ThinkJS 3.x base on node-jsonwebtoken

Build Status Coverage Status npm version

Install

npm install think-session-jwt --save

Quick Start

const JWTSession = require('think-session-jwt');

exports.session = {
  type: 'jwt',
  common: {
    cookie: {
      name: 'thinkjs',
    }
  },
  jwt: {
    handle: JWTSession,
    secret: 'secret', // secret is reqired
    tokenType: 'cookie', // ['query', 'body', 'header', 'cookie'], 'cookie' is default
    tokenName: 'jwt', // if tokenType not 'cookie', this will be token name, 'jwt' is default
    sign: {
      // sign options is not required
    },
    verify: {
      // verify options is not required
    },
    verifyCallback: any => any, // default verify fail callback
  }
}
  1. session数据从token中获取,通过配置tokenType指定token来源;
  2. 设置session数据后会返回token字符串;
  3. 配置verifyCallback函数,验证失败时返回该函数运行的结果;

Sign and verify options

使用node-jsonwebtoken的配置。

1.1.1

4 years ago

1.1.0

5 years ago

1.0.7

6 years ago

1.0.8

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago