wx-jssign
微信js-sdk网页签名,支持express和koa-generator调用,采用co函数支持promise方式调用
Last updated a year ago by yxz1025 .
ISC · Repository · Bugs · Original npm · Tarball
$ cnpm install wx-jssign 
SYNC missed versions from official npm registry.

wx-jssign

微信js-sdk网页签名,支持express和koa-generator调用

后端调用,需要redis模块用于缓存access_token

var WxSignPackage = require("wx-jssign");
var opts = {
  appid: "appid",
  secret: "secret",
  token: "公众号token",
  access_token_prefix: "access_token_prefix_",//缓存access_token得前缀key
  jsticket_prefix: "jsticket_prefix_",
  redis_auth: "redis密码",
  redis_host: "redis地址",
  redis_db: "redis第几个库"
};

var wxsign = new WxSignPackage(opts);

//支持json和jsonp
var url = req.query.url;
var callback = req.query.callback || "";
wxsign.getSignPackage(url)
    .then(function(package) {
        if (callback == "") {
            res.json(package);
        }else{
            res.jsonp(package);
        }
    }, function(err) {
        res.jsonp(err);
    });
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 16
Dependencies (6)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |