我想使用它刚刚获得的OAUth代码为我的应用程序获取访问令牌。这是我到目前为止所做的代码
DefaultHttpClient client = new DefaultHttpClient();
URI uri = new URIBuilder().setScheme("https")
.setHost("www.linkedin.com")
.setPath("/uas/oauth2/accessToken")
.setParameter("grant_type", "authorization_code")
.setParameter("code", code)
.setParameter("redirect_uri", "http://localhost:9090/ConnectSocialMedia/callBack.jsp")
.setParameter("client_id", CONSUMER_KEY_OPTION)
.setParameter("client_secret", CONSUMER_SECRET_OPTION)
.build();
HttpPost post = new HttpPost(uri);
post.setHeader("Content-Type", "application/x-www-form-urlencoded");
HttpResponse response2 = client.execute(post);
System.out.println("Final Response------------>"+response2);
但每次我每次都收到HTTP / 1.1 400 Bad Request。任何人都可以帮助我做错了。谢谢提前