easy-wechat-sdk
v1.0.2
Published
A simple library based on the WeChat API that supports getting permission signatures on Node.js.
Downloads
6
Maintainers
Readme
easy-wechat-sdk
A simple library based on the WeChat API that supports getting permission signatures on Node.js.
Install
Using npm
npm install easy-wechat-sdk --save
Usage
Website Service => WeChat-JSSDK
Get Permission verification configuration
const url = 'https://test.demo.com/usage/wechat'
const WeChatSDK = require('easy-wechat-sdk')
const WeChatJSSDK = new WeChatSDK('your_appId', 'your_appSecret')
let signPackage = null
try {
signPackage = await WeChatJSSDK.getSignPackage(url)
} catch(e) {
//Some exception, such as network error => request timeout.
}
Method
getSignPackage(url)
- url => {String} The url of current page.(required)
- return => {Object} permission verification configuration
Permission verification configuration
- appId => {String} WeChat AppId
- timestamp => {Number} timestamp, unit is seconds
- url => {String} the url of current page
- nonceStr => {String} random string
- jsapiTicket => {String} Temporary ticket for calling the WeChat JS interface
- signature => {String} permission signature
WeChat API
The following interfaces are used under the module easy-wechat-sdk
License
easy-wechat-sdk is MIT licensed.