Hi,

I have tried to connect to Facebook with Spring Social but it didn't work - I always get this exception trace above.
Does anybody know what I' am doing wrong? The accessToken is the right one, also appl ID. Secret Key is faced.
Thanks a lot for help!
Generic1

org.springframework.web.util.NestedServletExceptio n: Request processing failed; nested exception is org.springframework.web.client.HttpClientErrorExce ption: 400 Bad Request
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:681)
org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)

root cause

org.springframework.web.client.HttpClientErrorExce ption: 400 Bad Request
org.springframework.web.client.DefaultResponseErro rHandler.handleError(DefaultResponseErrorHandler.j ava:75)
org.springframework.web.client.RestTemplate.handle ResponseError(RestTemplate.java:486)
org.springframework.web.client.RestTemplate.doExec ute(RestTemplate.java:443)
org.springframework.web.client.RestTemplate.execut e(RestTemplate.java:401)
org.springframework.web.client.RestTemplate.postFo rObject(RestTemplate.java:279)
org.springframework.social.facebook.connect.Facebo okOAuth2Template.postForAccessGrant(FacebookOAuth2 Template.java:57)
org.springframework.social.oauth2.OAuth2Template.e xchangeForAccess(OAuth2Template.java:104)
at.eventtiming.frontend.controller.HomeController. handle(HomeController.java:40)
Code:
public final class HomeController {

    public HomeController() {}

    @RequestMapping("/index")
    public String handle(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory("338138429607553", "acafxxxxxxxxxb713200ffa81081");
        OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations();
        OAuth2Parameters params = new OAuth2Parameters();
        params.setRedirectUri("http://localhost:8080/JSPTest/index.htm");
        String authorizeUrl = oauthOperations.buildAuthorizeUrl(GrantType.AUTHORIZATION_CODE, params);
        System.out.println("authorizeUrl: " + authorizeUrl);
        response.sendRedirect(authorizeUrl);
        String accessToken = "AAAEziPz7ToEBAHsiLzF4GAte8oGa7lFTbzuRoZBzMubg2gfNSt0K2DS72sQSRmyRCVhRDjmmV4QWcFZCjTn6XPqsVIHltc1LpZA0kmJ2VxSYVw1TuwN";

        // upon receiving the callback from the provider:
        AccessGrant accessGrant = oauthOperations.exchangeForAccess(accessToken, "http://localhost:8080/JSPTest/index.htm", null);
        Connection<Facebook> connection = connectionFactory.createConnection(accessGrant);
        return "home";
        }
}