1.0.6 • Published 7 years ago

egg-weapp-oauth v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

egg-weapp-oauth

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-weapp-oauth --save

Usage

// {app_root}/config/plugin.js
exports.weappOauth = {
  enable: true,
  package: 'egg-weapp-oauth',
};

Configuration

// {app_root}/config/config.default.js
exports.weappOauth = {
    appid: '',
    secret: ''
};

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

Example

API 列表

getUser: 通过code获取用户信息:

let user = await app.weappOauth.getUser(code, encryptoData<可选>, iv<可选>);
// user: {openid, unionid, session_key, expires_in}
// user.userInfo: {openId, nickName, gender, language, city, province, country, avatarUrl, unionId, watermark}

特殊说明

  • encryptoData和iv为可选参数, 存在时进行解密并附加一个名为userInfo的Object;
  • unionid返回规则: UnionID机制说明

decrypt: 解密用户信息

let user = await app.weappOauth.decrypt(encryptoData, session_key, iv);

Questions & Suggestions

Please open an issue here.

License

MIT

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