tencentyun / wafer-session-server

Wafer - 企业级微信小程序全栈方案

Home Page:https://github.com/tencentyun/wafer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

微信返回的数据没有expires_in导致不能登录

TACanada opened this issue · comments

commented

今天一直运行的小程序,突然用户登录不了。
跟踪代码发现,这里面的验证语句和官方资料对应不上。
wafer-session-server/application/controllers/qcloud/minaauth/Auth.php 第45行-50行:

            $url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' . $appid . '&secret=' . $secret . '&js_code=' . $code . '&grant_type=authorization_code';
            $http_util = new http_util();
            $return_message = $http_util->http_get($url);
            if ($return_message!=false) {
                $json_message = json_decode($return_message, true);
                if (isset($json_message['openid']) && isset($json_message['session_key']) && isset($json_message['expires_in'])) {

这里是验证返回参数expires_in的。

但官方文档资料显示,没有expries_in这个返回参数
https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-login.html#wxloginobject

wx20170628-105950

我从log捕捉到的返回数据,也没有此返回:
{"session_key":"6svuTAm7735ujRdCArmFpQ==","openid":"ohTP90AzGSuWoyegbomo8GF9ztSQ"}

请帮忙看看是哪里不对了?谢谢。
奇怪的是,之前为什么又能正常运作呢?想不通。

应该是tx改接口了,我今天发现也用不了,调试半天才找到问题,将哪个参数检测去掉就可以了

没有任何通知和说明,浪费半天时间,还搞的心力憔悴,焦躁不安。可以骂人不?