无效令牌

来源:6-11 实现Shiro认证功能

MagicPiper

2022-09-28

按照这个步骤获取了code,后端也成功登录了,为什么在swagger里面还是无效令牌。
图片描述
图片描述
图片描述
图片描述

写回答

2回答

慕移动8561185

2023-03-14

请问解决了吗
0
3
路在脚下_pzl
回复
qq_慕虎8126360
我用的就是token,已经解决了🥺
2023-03-23
共3条回复

神思者

2022-09-28

你复制的令牌不完整,里面有省略号吧,你核对一下

0
1
MagicPiper
我在后端打印出来code拿去用还是无效令牌 private String getOpenId(String code) { String url = "https://api.weixin.qq.com/sns/jscode2session"; HashMap map = new HashMap(); map.put("appid", appId); map.put("secret", appSecret); map.put("js_code", code); map.put("grant_type", "authorization_code"); String response = HttpUtil.post(url, map); JSONObject json = JSONUtil.parseObj(response); String openId = json.getStr("openid"); System.out.println("临时登录凭证:"+code); if (openId == null || openId.length() == 0) { throw new RuntimeException("临时登陆凭证错误"); } return openId; }
2022-09-28
共1条回复

SpringBoot 在线协同办公小程序开发 全栈式项目实战

未来趋势型业务 + 前后端综合技术栈 + 惊艳的细节打磨

1798 学习 · 1915 问题

查看课程