获取access_token报 errcode":40125,"errmsg":"invalid appsecret
来源:7-4 换取access_token
qq_fcewdwed_0
2019-07-25
微信访问:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx5284c161a16a727b&redirect_uri=http%3A%2F%2Fyaokou828.natapp1.cc%2Fsell%2Fweixin%2Fauth&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
代码在这:
@RestController
@RequestMapping("/weixin")
@Slf4j
public class WeixinController {
@GetMapping("/auth")
public void auth(@RequestParam(“code”) String code){
log.info(“进入auth方法…”);
log.info(“code={}”,code);
String url =“https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx5284c161a16a727b&secret=appsecret&code=”
+code+"&grant_type=authorization_code";
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.getForObject(url, String.class);
log.info(“result={}”,result);
}
}
报错:result={“errcode”:40125,“errmsg”:“invalid appsecret, view more at http://t.cn/RAEkdVq, hints: [ req_id: PGmdzQaLRa-Q3IfKa ]”}
谁遇到过,怎么解决。急!!!!
3回答
-
廖师兄
2019-07-26
嗯,提示里已经说了,invalid appsecret
10 -
qq_慕标5172947
2020-01-20
或者有可能是secret变了,刷新一下网页重新看一下appsecret
012021-05-11 -
qq_fcewdwed_0
提问者
2019-07-25
粗心了,获取access_token中的secret=appsecret应该换成自己的就好了
00
相似问题