Skip to content

cy08/wechatOauthJSSDk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

wechatOauthJSSDk

1.微信授权和JSSDK签名模块

所需依赖

 1.服务端  express
 2.异步请求  request
3.缓存 memory-cache
4.加密模块 crypto

使用方法

let express = require('express'),
    app = express();
    wechatOauthJSSDk = require('./wechat/wechat'),
    crypto = require('crypto'), //加密模块
    cache = require('memory-cache'), //缓存
    request = require('request'); //异步请求模块
    app.use(express.static('www'));
    
wechatOauthJSSDk = new wechatOauthJSSDk(wxConfig);

let wxConfig = {
      host: "http://xxxx.com",
      appid: "公众号APPID",
      appsecret: "公众号appsecret",
      noncestr: "随机字符串",// 默认 U9QPiKjfV8869MmQWRT5du
      expirytime: 1000 * 60 * 60 * 2 // 默认2小时
}

app.get('/oauth', wechatOauthJSSDk.oauth.bind(wechatOauthJSSDk));//获取授权信息

//接收授权信息
wechatOauthJSSDk.oauthData=function(data, res) {
	console.log(data);
}

app.post('/wxConfigSDK', wechatOauthJSSDk.JSSDK.bind(wechatOauthJSSDk));//获取JSSDK

app.listen(8899, () => { console.log("端口:8899") });

About

微信授权JSDDK签名

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published