0
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
}

When it run this code then shows error:

HTTP Status 500 - oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Server returned HTTP response code: 403 for URL: https://api.linkedin.com/uas/oauth/requestToken

Qiu
  • 5,651
  • 10
  • 49
  • 56
  • Please change the title of your question? It should be something meaningful about your problem not a general statement. – sakura May 29 '15 at 06:48
  • 1
    First of all check the URL (you mentioned) is still valid. Second, look at below link. It seems there is some change in API access. - https://developer.linkedin.com/support/developer-program-transition#troubleshooting - https://developer.linkedin.com/docs/rest-api – gsmaker May 29 '15 at 06:50

0 Answers0