How to do it...

This recipe creates the facebook-login-oauth2 project, which is available on GitHub in the Chapter06 folder. Import the generated project as a Maven project into your IDE and follow these steps:

  1. Open the pom.xml file and add the following extra dependencies for Spring Security OAuth2 and Thymeleaf extras for Spring Security (note that we are declaring the most up-to-date version of Spring Security OAuth2 at the time of writing this). I am assuming that you have already imported the starters for Web, Thymeleaf, JPA, H2, and Security:
<dependency>   <groupId>org.thymeleaf.extras</groupId>   <artifactId>thymeleaf-extras-springsecurity4</artifactId></dependency><dependency>   <groupId>org.springframework.security.oauth</groupId>

Get OAuth 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.