egg-weapp-oauth
Install
$ npm i egg-weapp-oauth --save
Usage
// {app_root}/config/plugin.jsexportsweappOauth = enable: true package: 'egg-weapp-oauth';
Configuration
// {app_root}/config/config.default.jsexportsweappOauth = appid: '' secret: '';
see config/config.default.js for more detail.
Example
API 列表
getUser: 通过code获取用户信息:
let user = await appweappOauth;// 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 appweappOauth;
Questions & Suggestions
Please open an issue here.