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

消息校验机制疑惑 #19

Open
youlanstudio opened this issue May 20, 2014 · 3 comments
Open

消息校验机制疑惑 #19

youlanstudio opened this issue May 20, 2014 · 3 comments

Comments

@youlanstudio
Copy link

微信开发文档上描述:
“每次开发者接收用户消息的时候,微信也都会带上前面三个参数(signature、timestamp、nonce)访问开发者设置的URL,开发者依然通过对签名的效验判断此条消息的真实性。效验方式与首次提交验证申请一致。”
这个不是很好理解。微信后面的消息,都是POST消息。而一开始的验证消息是GET消息。后面的微信发过来的消息中,是怎么带这几个验证参数的?

用现在的SDK,每次通过微信提供的页面调试接口调试,都是返回签名校验失败,修成如下的形式就OK。
if ($this->isValid()) {
if (!$this->validateSignature($token)) {
exit('签名验证失败');
}
// 网址接入验证
exit($_GET['echostr']);
}

@youlanstudio
Copy link
Author

应该是微信那个接口调试工具有问题,它应该是没有带签名信息

@netputer
Copy link
Owner

建议自己的代码里还是带上签名校验,就算 URL 泄露了也还有签名需要验证。

@shizhao
Copy link

shizhao commented Jul 21, 2014

我也是网页上返回签名验证失败,但是微信后台却是验证成功了....

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

3 participants