weixin-auth

1.1.1 • Public • Published

Build Status Coverage

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

Readme

Keywords

Package Sidebar

Install

npm i weixin-auth

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

9.05 kB

Total Files

12

Last publish

Collaborators

  • kael