last day (16 days later) » 

9:32 AM
0
A: Facebook Spring Boot login with OAuth2

Francesc RecioYou can do it integrated to spring with spring-social dependence, which is intended for the integration of spring security with authentication in social networks. First add dependency: <dependency> <groupId>org.springframework.social</groupId> <artifactId>spring-social-facebook</artifactId

 
Thank you very much! I read about it before... but I can't understand which is the suggested way to do so... I mean... why should I use spring-social instead of OAuth2? Is there a reason?
 
No, spring social connect with social networks for facebook login and integrates with your OAuth2, but you still have your normal security settings.
 
I'm not using OAuth2 right now... I'm just using Spring Security. I was considering to use it because I read that people use it in order to let people login into their systems using socials like Facebook, Google etc. So the question is, why should I use spring-social instead of OAuth2 in order to integrate social login and registration into my webapp?
 
Because social spring is made to facilitate this integration with social networks and avoid having to do everything by hand, request tokens, integrate that token with spring security, keep that session in your context....
 
Ok I see, so just to make it 100% clear, are you saying that integrating a social login in a Spring Boot webapp is easier with Social Spring instead of doing it only with OAuth2 like a lot of guides suggests? Btw I find your suggestion easier too so if nobody has a better solution, I would go with Social Spring... thank you again!
In the solution you propose it tells me that UsersConnectionRepository and ConnectionFactoryLocator can't be autowired, it can't find the beans of those types. I'm using Spring Boot 2.0.6.RELEASE and spring-social-facebook 2.0.3.RELEASE. Any idea?
 
9:32 AM
Add to SecurityConfiguration annotations are the ones you already had.
 
what do you mean?
 
@EnableGlobalMethodSecurity(prePostEnabled = true) @EnableWebSecurity @EnableJpaRepositories(basePackageClasses = UserRepository.class) @Configuration, because UsersConnectionRepository and ConnectionFactoryLocator are beans of spring social in the context.
 
The problem is that UserConnectionRepository and ConnectionFactoryLocator cannot be autowired and I don’t know why...
ok but how can I solve it?
 
that’s the example you posted, the one that I used, the one that tells me that those two classes can’t be autowired!
 
9:32 AM
I just downloaded it, mvn clean install spring-boot:run and it starts perfect.
 
9:42 AM
the pom.xml is splitted in two files.. how can I merge them to integrate it in my project? it's not that clear... and if I don't compile and run the project from the terminal but from IntelliJ it does not recognise a lot of dependencies...
 
two files? spring-social-login only has 1 pom.xml
 

  last day (16 days later) »