获取小程序accessToken


private static String getAccessToken(){
	        String url = "https://api.weixin.qq.com/cgi-bin/token?			                                grant_type=client_credential&appid="+"wx5d6fccb4d0b05cd8"+"&secret="+"5cba895998cad2b0d0b5895ee43891bd";
	        String wxJson = new RestTemplate().getForEntity(url, String.class).getBody();
	        System.out.println("access-token响应: {}"+wxJson);
	        com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(wxJson);
	        Object accessTokenObj = jsonObject.get("access_token");
	        if(accessTokenObj == null){
	            return null;
	        }
	        String a=accessTokenObj.toString().split(",")[0].split(":")[0];
	        return a;
	    }

  ,


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM