Results 1 to 2 of 2

Thread: Facebook, no suitable HttpMessageConverter found

Threaded View

  1. #1
    Join Date
    Jul 2010
    Posts
    10

    Default Facebook, no suitable HttpMessageConverter found

    Hey everyone,

    I been working on a proof on concept at work.. Just trying to get oAuth2 connection from my client application to facebook. I got to the point where my client app is trying to get the access_token from facebook, but then I get the following exceptions..


    Code:
    2012-09-11 06:28:34.458 PDT [tomcat-http--39] DEBUG client.token.grant.code.AuthorizationCodeAccessTokenProvider - Retrieving token from https://graph.facebook.com/oauth/access_token?client_id=XXXXXX&client_secret=XXXXXX
    2012-09-11 06:28:34.507 PDT [tomcat-http--39] DEBUG org.springframework.web.client.RestTemplate - Created POST request for "https://graph.facebook.com/oauth/access_token?client_id=XXXXXX&client_secret=XXXXX"
    2012-09-11 06:28:35.207 PDT [tomcat-http--39] DEBUG org.springframework.web.client.RestTemplate - POST request for "https://graph.facebook.com/oauth/access_token?client_id=XXXXXXX&client_secret=XXXXXX" resulted in 200 (OK)
    2012-09-11 06:28:35.262 PDT [tomcat-http--39] DEBUG springframework.security.web.access.ExceptionTranslationFilter - Access is denied (user is not anonymous); delegating to AccessDeniedHandler
    org.springframework.security.oauth2.client.resource.OAuth2AccessDeniedException: Error requesting access token.
            at org.springframework.security.oauth2.client.token.OAuth2AccessTokenSupport.retrieveToken(OAuth2AccessTokenSupport.java:102)
            at org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeAccessTokenProvider.obtainAccessToken(AuthorizationCodeAccessTokenProvider.java:56)
            at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainNewAccessTokenInternal(AccessTokenProviderChain.java:110)
            at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainAccessToken(AccessTokenProviderChain.java:90)
    ...
    Caused by: org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.security.oauth2.common.OAuth2AccessToken] and content type [text/plain;charset=UTF-8]
            at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:84)
            at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446)
            at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)
            at org.springframework.security.oauth2.client.token.OAuth2AccessTokenSupport.retrieveToken(OAuth2AccessTokenSupport.java:94)
            ... 44 more

    I have the following messageConverters injected, just like in the tonr2 sample app..

    Code:
    <property name="messageConverters">
        <list>
            <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <bean class="org.springframework.http.MediaType">
                            <!--facebook sends its json as text/javascript for some reason -->
                            <constructor-arg value="text" />
                            <constructor-arg value="javascript" />
                        </bean>
                        <bean class="org.springframework.http.MediaType">
                            <constructor-arg value="application" />
                            <constructor-arg value="json" />
                        </bean>
                    </list>
                </property>
            </bean>
        </list>
    </property>
    What am I missing here? Any help would be really appreciated.. Thanks
    Last edited by jdevWF; Sep 11th, 2012 at 08:48 AM. Reason: had some sensitive info..

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •