Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koa2安装使用这个封装库后所有路由访问都是提示Invalid signature #42

Open
ManiuLtd opened this issue Nov 9, 2018 · 8 comments

Comments

@ManiuLtd
Copy link

ManiuLtd commented Nov 9, 2018

作者你好,感谢提供这个封装库,这使得在做微信回复功能从原来数小时缩短至数分钟,由于我是刚学习nodejs不久,也是刚使用koa2,在我原有项目中使用该库里面本身的路由访问全部提示Invalid signature,请问作者如何解决啊

@JacksonTian
Copy link
Member

路由限定下。。

@QXK169
Copy link

QXK169 commented Dec 14, 2018

const Router = require('koa-router');
const wechat = require('co-wechat');

const config = {
token: process.env.wechat_token,
appid: process.env.wechat_appid,
encodingAESKey: process.env.wechat_encodingAESKey
};

const router = new Router();
router.use(‘/we-chat-biz’,wechat(config).middleware(async (message, ctx) => {
return 'aaa';
}));

module.exports = router;

index.js

const Koa = require('koa');
let Wx = require('./routes/wx.js');
app.use(Wx.routes())
app.listen(3000, ()=> {
console.log('server is set up')
});
这样运行 为啥不行呀,将 router.use 换成 router.get 微信token就可以验证成功,但是还是收不到微信回复,请问怎么解决啊

@JacksonTian
Copy link
Member

抓包排查下错误吧。

@bellchet58
Copy link
Contributor

是用微信公众平台接口调试工具测试的吗?看了下源码POST的请求好像都会有验签这一步,但实际query是没有带timestamp, nonce, echostr这些参数的

@Juliiii
Copy link

Juliiii commented Aug 24, 2019

@bellchet58 @JacksonTian 我看这个仁兄的新增的isDebug参数已经合主干了,然而npm那里还是
image。变更后没有发npm包么?

@JacksonTian
Copy link
Member

@Juliiii 我看一下。

@JacksonTian
Copy link
Member

@Juliiii released.

@Juliiii
Copy link

Juliiii commented Aug 26, 2019

@Juliiii released.

nice~ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants