调用auth.code2Session返回值报错,怎么解决?
{“errcode”:40013,“errmsg”:“invalid appid, hints: [ req_id: JGHEu.wgE-ctEZVA ]”}
public String do_get(String JSCODE) throws ClientProtocolException, IOException { String body = "{}" ; String APPID = "wxbea50118b27deed2" ; String SECRET = "916e340c613a39a413076a03d5379692" ; // String JSCODE1 = "021Ktl4S1ognG510zT2S1f7w4S1Ktl4Q"; DefaultHttpClient httpclient = new DefaultHttpClient(); try { HttpGet httpget = new HttpGet( "https://api.weixin.qq.com/sns/jscode2session?appid=" +APPID+ "+&secret=" +SECRET+ "&js_code=" +JSCODE+ "&grant_type=authorization_code" ); SSLSocketFactory.getSocketFactory().setHostnameVerifier( new AllowAllHostnameVerifier()); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); body = EntityUtils.toString(entity); System.out.println(body); } finally { httpclient.getConnectionManager().shutdown(); } return body; } |