Java 获取到linkedin的连接时出错
运行此代码时,将显示错误: HTTP状态500-oauth.signpost.exception.OAuthCommunicationException:与服务提供商的通信失败:服务器返回了URL的HTTP响应代码:403:Java 获取到linkedin的连接时出错,java,servlets,linkedin-j,Java,Servlets,Linkedin J,运行此代码时,将显示错误: HTTP状态500-oauth.signpost.exception.OAuthCommunicationException:与服务提供商的通信失败:服务器返回了URL的HTTP响应代码:403: 请更改问题的标题?这应该是关于你的问题的有意义的东西,而不是一般性的陈述。首先检查URL(你提到的)是否仍然有效。第二,看看下面的链接。API访问似乎有一些变化- protected void doGet(HttpServletRequest request, HttpSe
请更改问题的标题?这应该是关于你的问题的有意义的东西,而不是一般性的陈述。首先检查URL(你提到的)是否仍然有效。第二,看看下面的链接。API访问似乎有一些变化-
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
final LinkedInOAuthService oauthService = LinkedInOAuthServiceFactory.getInstance().createLinkedInOAuthService(CONSUMER_KEY, CONSUMER_KEY_SECRET);
try {
StringBuffer callbackURL = request.getRequestURL();
int index = callbackURL.lastIndexOf("/");
callbackURL.replace(index, callbackURL.length(), "").append("/LinkedInCallbackServlet");
LinkedInRequestToken requestToken = oauthService.getOAuthRequestToken(callbackURL.toString());
request.getSession().setAttribute("requestToken", requestToken);
System.out.println("token:"+requestToken);
System.out.println("Success");
String path=callbackURL.toString();
String verifier = request.getParameter("oauth_verifier");
System.out.println("----"+verifier);
response.sendRedirect(requestToken.getAuthorizationUrl());
} catch (LinkedInApiClientException e) {
throw new ServletException(e);
}
}
/** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stubss
}