600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > springboot通过code获取微信公众号openId

springboot通过code获取微信公众号openId

时间:2022-03-29 11:01:46

相关推荐

springboot通过code获取微信公众号openId

@RequestMapping("/getOpenId")public String wxcallback(String code){// 第二步:通过code换取网页授权access_tokenString url = "https://api./sns/oauth2/access_token?appid=" + wxAppID +"&secret=" + secret +"&code=" + code +"&grant_type=authorization_code";ResponseEntity<String> res = restTemplate.getForEntity(url, String.class);JSONObject jsonObject = JSONObject.parseObject(res.getBody());return jsonObject.get("openid").toString();}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。