602 Star 1.9K Fork 675

Javen / weixin_guide

 / 详情

weixin_guide的oauth访问2次,请问如何排重

已完成
创建于  
2017-12-04 01:28

困扰我的一个问题,每次通过toOauth访问WeiXinOauthController或直接访问WeiXinOauthController都显示访问2次,以至于第2次无法获取openid,因为code只能用1次,第2次就获取不到accesstoken和oauth了,请问如何处理?

[ERROR]-[Thread: http-nio-8080-exec-7]-[com.jfinal.kit.LogKit.error()]: retry on 1 times but not matching v = {"errcode":40163,"errmsg":"code been used, hints: [ req_id: 4Kgc3a0768th19 ]"}
2017-12-04 01:22:48
[ERROR]-[Thread: http-nio-8080-exec-7]-[com.jfinal.kit.LogKit.error()]: retry on 2 times but not matching v = {"errcode":40163,"errmsg":"code been used, hints: [ req_id: 0768th21 ]"}
2017-12-04 01:22:48
[ERROR]-[Thread: http-nio-8080-exec-7]-[com.jfinal.kit.LogKit.error()]: retry on 3 times but not matching v = {"errcode":40163,"errmsg":"code been used, hints: [ req_id: PaF.uA0768th44 ]"}
2017-12-04 01:22:48
[INFO]-[Thread: http-nio-8080-exec-7]-[com.javen.weixin.controller.WeiXinOauthController.index()]: token:null
2017-12-04 01:22:48
[WARN]-[Thread: http-nio-8080-exec-7]-[com.javen.weixin.controller.WeiXinOauthController.index()]: getUserInfo:{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest, hints: [ req_id: xc0768s150 ]"}

评论 (4)

Eland 创建了任务

单次调用是不会出现这种情况的,请检查下你的业务逻辑。

如果是使用的 weixin_guide 没有修改路由的情况下,通过toOauth 来通过授权获取用户信息那么菜单中的地址应该是http://域名[/项目名称]/toOauth。回调地址填写 http://域名[/项目名称]/oauth

也许你点击了返回键 可以参考这个issues https://gitee.com/jfinal/jfinal-weixin/issues/I9XBU

@Javen 我的解决方案是第一步获取code,暂时不跳到toOauth,然后用户点击后我再跳toOauth,这样保险点。可能是微信公众号机制是多次回调。

Eland 关闭了任务

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
366390 javen205 1578921662 47032 elandyang 1578915664
Java
1
https://gitee.com/javen205/weixin_guide.git
git@gitee.com:javen205/weixin_guide.git
javen205
weixin_guide
weixin_guide

搜索帮助