獲取小程序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