easy-wechat-sdk

1.0.2 • Public • Published

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.

Package Sidebar

Install

npm i easy-wechat-sdk

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

7.47 kB

Total Files

6

Last publish

Collaborators

  • amoydreamer