http://127.0.0.1:8080/Mailchimp/Access#access_token=^^^^^^^^^^^^^^^^^^^^^^^^^&expires_in=0
这是我的 mailchimp url,如何通过 java 提取 access_token
还有另一种获取访问令牌的方法,但这里得到响应消息 - 错误请求
URL siteUrl = new URL("https://login.mailchimp.com/oauth2/token");
HttpURLConnection conn = (HttpURLConnection) siteUrl.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
String content = "?grant_type=authorization_code&client_id=^^^^^^^^^^&client_secret=^^^^^^^^^^^^^^^^^^^^^^^^&code="+auth_code+"&redirect_uri=http://127.0.0.1:8080/Mailchimp/Access";
out.writeBytes(content);
System.out.println(content);
out.flush();
out.close();
System.out.println(conn.getResponseMessage());