1.1.1 • Published 6 years ago
weixin-auth v1.1.1
weixin-auth
Wechat Authorization
Install
$ npm install weixin-auth
Usage
import {WechatMP, mock} from 'weixin-auth'
const mp = new WechatMP({
appId: '<wechat mini-program appid>',
secret: '<wechat mini-program secret>'
})
await mp.auth(code)
// {
// openid: ...,
// unionid: ...,
// session_key: ...
// }
// We can mock the result for debugging purpose
mock({
openid: 'a',
unionid: 'b',
session_key: 'c'
})
await mp.auth(code)
// {
// openid: 'a',
// unionid: 'b',
// session_key: 'c'
// }
License
MIT