@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();}
600字范文,内容丰富有趣,生活中的好帮手!