https://github.com/kaelzhang/weixin-auth
Wechat authorization
https://github.com/kaelzhang/weixin-auth
authorization nodejs wechat
Last synced: about 1 month ago
JSON representation
Wechat authorization
- Host: GitHub
- URL: https://github.com/kaelzhang/weixin-auth
- Owner: kaelzhang
- License: other
- Created: 2017-11-13T10:23:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-04T02:58:03.000Z (almost 8 years ago)
- Last Synced: 2025-03-25T13:16:19.785Z (about 1 year ago)
- Topics: authorization, nodejs, wechat
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
[](https://travis-ci.org/kaelzhang/weixin-auth)
[](https://codecov.io/gh/kaelzhang/weixin-auth)
# weixin-auth
Wechat Authorization
## Install
```sh
$ npm install weixin-auth
```
## Usage
```js
import {WechatMP, mock} from 'weixin-auth'
const mp = new WechatMP({
appId: '',
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