weixin-auth
v1.1.1
Published
weixin-auth
Downloads
2
Readme
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