使用微信测试号, 花生壳内网穿透

需要注意 token 两边都是自定义, 需要保持一致,

const Koa = require('koa')
const sha1 = require('sha1') const app = new Koa() const config = {
wechat: {
appID: '', //填写你自己的appID
appSecret: '', //填写你自己的appSecret
token: '' //填写你自己的token
}
} app.use(async (ctx) => {
const token = config.wechat.token
const signature = ctx.request.query.signature
const nonce = ctx.request.query.nonce
const timestamp = ctx.request.query.timestamp
const echostr = ctx.request.query.echostr
let str = [token, timestamp, nonce].sort().join('')
const sha = sha1(str)
ctx.body = sha === signature ? echostr + '' : 'failed'
}) app.listen(, () => {
console.log('node started port 8999')
})

微信测试号地址  点击验证  显示配置成功即可

最新文章

  1. NginxWeb服务器安装
  2. windows多线程编程实现 简单(1)
  3. Linux FHS
  4. leetcode 419
  5. Java 创建xml文件和操作xml数据
  6. python list求交集
  7. lightoj 1064 Throwing Dice
  8. Linux-C语言中gettimeofday()函数的使用方法(转载)
  9. VC/MFC 工具栏上动态添加组合框等控件的方法
  10. Android_app项目开发步骤总结
  11. perl-cgi命令行调试
  12. 强化学习读书笔记 - 02 - 多臂老O虎O机问题
  13. 【Egret】Lakeshore 使用中的一些疑难解决技巧!
  14. 业务与IT技术
  15. C语言strcpy,strncpy和strlcpy讲解
  16. Linux文件系统备份
  17. 如何利用一台pc获取百万利益 《标题党》
  18. 03 Zabbix常用的术语
  19. PAT L3-010 是否完全二叉搜索树(二叉搜索树)
  20. 安装win8/win10提示无法在驱动器0分区上安装windows解决方法

热门文章

  1. JQuery中如何重置(reset)表单(且清空隐藏域)
  2. centos 7: 迁移MySQL目录
  3. HTTP状态码图示
  4. AE 创建
  5. poj 2955 Brackets dp简单题
  6. mac 浏览器解决跨域问题
  7. Combining an audio file with video file in python
  8. C#中的文件导出大全
  9. webview 播放H5视频问题 黑屏 只有声音没有画面
  10. mysql的启动和停止