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..
What am I missing here? Any help would be really appreciated.. ThanksCode:<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>


Reply With Quote
