Announcement Announcement Module
Collapse
No announcement yet.
Problem creating linkedin connector Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem creating linkedin connector

    Hi I have a problem connecting to linked in. It seems the connection itself is fine, but the moment I try to use the LinkedinTemplate I get a 404

    Code:
    DEBUG - ttp-8080-1 - RestTemplate               - Created GET request for "https://api.linkedin.com/v1/people/~:public"
    DEBUG - ttp-8080-1 - RestTemplate               - Setting request Accept header to [application/xml, text/xml, application/*+xml, application/json]
    WARN  - ttp-8080-1 - RestTemplate               - GET request for "https://api.linkedin.com/v1/people/~:public" resulted in 404 (Not Found); invoking error handler
    DEBUG - ttp-8080-1 - odHandlerExceptionResolver - Resolving exception from handler [nl.gridshore.samples.springoauth.web.ConnectController@132f4538]: org.springframework.web.client.HttpClientErrorException: 404 Not Found
    DEBUG - ttp-8080-1 - nseStatusExceptionResolver - Resolving exception from handler [nl.gridshore.samples.springoauth.web.ConnectController@132f4538]: org.springframework.web.client.HttpClientErrorException: 404 Not Found
    DEBUG - ttp-8080-1 - ltHandlerExceptionResolver - Resolving exception from handler [nl.gridshore.samples.springoauth.web.ConnectController@132f4538]: org.springframework.web.client.HttpClientErrorException: 404 Not Found
    DEBUG - ttp-8080-1 - DispatcherServlet          - Could not complete request
    org.springframework.web.client.HttpClientErrorException: 404 Not Found
    	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:69)
    	at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486)
    	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443)
    	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
    	at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:199)
    	at org.springframework.social.linkedin.LinkedInTemplate.getUserProfile(LinkedInTemplate.java:74)
    	at org.springframework.social.linkedin.LinkedInTemplate.getProfileUrl(LinkedInTemplate.java:70)
    	at nl.gridshore.samples.springoauth.web.ConnectController.authorizeCallback(ConnectController.java:56)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427)
    	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	at java.lang.Thread.run(Thread.java:680)
    DEBUG - ttp-8080-1 - tyContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
    Below are the lines of code in my controller, any clue on the direction to look for a solution?

    Code:
            Token oauth_session_token = (Token)request.getAttribute(OAUTH_TOKEN_ATTRIBUTE, WebRequest.SCOPE_SESSION);
    
            LinkedInTemplate template = new LinkedInTemplate(
                    "a key ...",
                    "a secret ...",
                    oauth_session_token.getToken(),
                    oauth_session_token.getSecret());
            System.out.println(template.getProfileUrl());
            List<LinkedInProfile> connections = template.getConnections();
            List<String> names = new ArrayList<String>();
            for (LinkedInProfile profile : connections) {
                names.add(profile.getLastName());
            }
            request.setAttribute("names",names,WebRequest.SCOPE_REQUEST);
    
            return "connections";
    thanks for helping out
    Last edited by jettro; Nov 1st, 2010, 03:54 PM.

  • #2
    Oke, is usual, it just works but I made a mistake. For those having the same problem, I forgot to actually obtain the access token. I only had the request token. Then I used the request token to call the api and of course that must be the access token.

    Comment

    Working...
    X