大家下午好,
我在开发小程序的时候,需要在后台通过前端返回的code拿到openid,但总是失败。
小程序本地调试访问localhost服务(sprintBoot),但总是返回如下错误:
<200,{"errcode":41008,"errmsg":"missing code, hints: [ req_id: 0gFEdZyFe-77ezBa ]"},[Connection:"keep-alive", Content-Type:"text/plain", Date:"Mon, 12 Oct 2020 05:53:26 GMT", Content-Length:"78"]>
java代码访问如下api:
https://api.weixin.qq.com/sns/jscode2session?appid=wx34109679d5eaffec&secret={encoded secret}&js_code=033fYx1w3MBM7V2kSc3w3WzYrs0fYx1M&grant_type=authorization_code
请帮忙看下哪里有问题,因为error message是missing code,但code确实是传过去了, 我尝试了get和post都不行。
谢谢,
你的secret有问题吧?
我是在小程序管理平台上copy下来的 【AppSecret(小程序密钥) 】,存到文件通过string方式读出。然后做一次url encode,再拼接到url中。那我重置一个新的secret再试试。