0

I have followed the steps given in the below site to create a simple spring boot application that access the facebook data using maven and spring boot.

http://spring.io/guides/gs/accessing-facebook/

which is also same as http://www.technicalkeeda.com/spring/spring-social-facebook-integration-example but in gradle.

The problem i am facing is when i am trying to run the application, I have am seeing that url is successfully redirected to "/connect/facebook" but it doesnt load the facebookConnect.html instead it throws error as shown below:

" Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Mar 10 19:24:41 IST 2015

There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported "

I have also tried using the same code given in the site and also used my facebook appId and appSecret in it , which i had generated by giving a random host name in the facebook app, still i get same error.

I have also tried adding the random host name which i created to the /etc/hosts file in the windows.

Could anyone please help me why i am not able to see the .html page that has to be rendered by the ConnectController automatically ?

  • you are right it is redirecting to url /connect/facebook but with error and on server side you are not handling the /connect/facebook/error, that is why it is no explicit mapping for /error. – Arpit Aggarwal Mar 10 '15 at 14:21
  • but actually it has to redirect to the "facebookConnect.html" right ,according to the instructions ? any idea why it is not getting redirecting and what is the error on server side ?? – user3298833 Mar 10 '15 at 14:30
  • Might this will help you : http://aggarwalarpit.blogspot.in/2014/08/spring-social-integration-with-facebook.html – Arpit Aggarwal Mar 10 '15 at 14:48
  • this might get me the work done, but actually i am trying to learn spring boot and spring social , so i thought it would be better to start from a simple application and understand how it works. moreover the link which had shared has xml configurations, where as i am trying to do without xml using annotaions as shared in the above link. – user3298833 Mar 10 '15 at 14:59
  • anyway thanks Arpit, I have not defined any connectController in my code as it was mentioned in the tutorail . do you think that i need to add any configuration related to connectController , so that it will redirect automatically only then ? – user3298833 Mar 10 '15 at 15:01

2 Answers2

3

I finally got the answer. it is we need to additional parameter in the application.properties file which is

"spring.social.auto_connection_views=true

along with the id and secret.

spring.social.facebook.appId=

spring.social.facebook.appSecret=

this property was not mentioned in the tutorials. finally this worked. :) "

0

Had the exact same issue. spring.social.auto-connection-views: true in the application.yml (or .parameter equivalent) does indeed solve it, but then the default facebookConnect.html and facebookConnected.html are being used.

I solved it by removing the above application parameter and simply adding Thymeleaf tempting engine to the pom.xml:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

And then you can use your own facebookConnect.html and facebookConnected.html located at src/main/resources/templates/connect/

Hope it can help.

Ralph Marschall
  • 139
  • 2
  • 7