http://127.0.0.1:8080/Mailchimp/Access#access_token=^^^^^^^^^^^^^^^^^^^^^^^^^&expires_in=0
的URL中提取的access_token這是我的mailchimp網址,如何通過Java如何從Mailchimp
提取的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());
從servlet響應即獲得代碼參數代碼= AUTH_CODE – behinddwalls